diff mbox

[perftest,22/23] multicast_resources: use strncpy() to prevent overflow possibility

Message ID 1471541538-20270-23-git-send-email-jarod@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jarod Wilson Aug. 18, 2016, 5:32 p.m. UTC
CC: Gil Rockah <gilr@mellanox.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 src/multicast_resources.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/multicast_resources.c b/src/multicast_resources.c
index 3a8edba..f5e4bea 100755
--- a/src/multicast_resources.c
+++ b/src/multicast_resources.c
@@ -160,7 +160,7 @@  void set_multicast_gid(struct mcast_parameters *params,uint32_t qp_num,int is_cl
 		}
 		pstr += term - pstr + 1;
 
-		strcpy(tmp, pstr);
+		strncpy(tmp, pstr, sizeof(tmp) - 1);
 		mcg_gid[15] = (unsigned char)strtoll(tmp, NULL, 0);
 	}