diff --git a/lib/iscsi/init_grp.c b/lib/iscsi/init_grp.c index c46fb8074..ea72849b0 100644 --- a/lib/iscsi/init_grp.c +++ b/lib/iscsi/init_grp.c @@ -106,7 +106,7 @@ spdk_iscsi_init_grp_add_initiator(struct spdk_iscsi_init_grp *ig, char *name) if (p != NULL) { SPDK_WARNLOG("Please use \"%s\" instead of \"%s\"\n", "ANY", "ALL"); SPDK_WARNLOG("Converting \"%s\" to \"%s\" automatically\n", "ALL", "ANY"); - strncpy(p, "ANY", 3); + memcpy(p, "ANY", 3); } TAILQ_INSERT_TAIL(&ig->initiator_head, iname, tailq); @@ -239,7 +239,7 @@ spdk_iscsi_init_grp_add_netmask(struct spdk_iscsi_init_grp *ig, char *mask) if (p != NULL) { SPDK_WARNLOG("Please use \"%s\" instead of \"%s\"\n", "ANY", "ALL"); SPDK_WARNLOG("Converting \"%s\" to \"%s\" automatically\n", "ALL", "ANY"); - strncpy(p, "ANY", 3); + memcpy(p, "ANY", 3); } TAILQ_INSERT_TAIL(&ig->netmask_head, imask, tailq); diff --git a/lib/iscsi/portal_grp.c b/lib/iscsi/portal_grp.c index 6c6f7fedd..0a09e28b9 100644 --- a/lib/iscsi/portal_grp.c +++ b/lib/iscsi/portal_grp.c @@ -253,7 +253,7 @@ spdk_iscsi_parse_portal(const char *portalstring, struct spdk_iscsi_portal **ip, SPDK_ERRLOG("malloc() failed for host\n"); goto error_out; } - strncpy(host, portalstring, len); + memcpy(host, portalstring, len); host[len] = '\0'; } @@ -288,7 +288,7 @@ spdk_iscsi_parse_portal(const char *portalstring, struct spdk_iscsi_portal **ip, SPDK_ERRLOG("malloc() failed for port\n"); goto error_out; } - strncpy(port, p + 1, len); + memcpy(port, p + 1, len); port[len] = '\0'; } } @@ -308,7 +308,7 @@ spdk_iscsi_parse_portal(const char *portalstring, struct spdk_iscsi_portal **ip, SPDK_ERRLOG("malloc() failed for cpumask\n"); goto error_out; } - strncpy(cpumask, p + 1, len); + memcpy(cpumask, p + 1, len); cpumask[len] = '\0'; } }