Merge pull request #4243 from mjstapp/fix_dplane_strlcpy

zebra: replace strncpy with strlcpy in dplane
This commit is contained in:
Donald Sharp 2019-05-02 10:58:47 -04:00 committed by GitHub
commit feb3b57e49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1706,7 +1706,7 @@ static enum zebra_dplane_result intf_addr_update_internal(
/* Init the interface-addr-specific area */
memset(&ctx->u.intf, 0, sizeof(ctx->u.intf));
strncpy(ctx->u.intf.ifname, ifp->name, sizeof(ctx->u.intf.ifname));
strlcpy(ctx->u.intf.ifname, ifp->name, sizeof(ctx->u.intf.ifname));
ctx->u.intf.ifindex = ifp->ifindex;
ctx->u.intf.prefix = *(ifc->address);
@ -1734,7 +1734,7 @@ static enum zebra_dplane_result intf_addr_update_internal(
len = strlen(ifc->label);
if (len < sizeof(ctx->u.intf.label_buf)) {
strncpy(ctx->u.intf.label_buf, ifc->label,
strlcpy(ctx->u.intf.label_buf, ifc->label,
sizeof(ctx->u.intf.label_buf));
ctx->u.intf.label = ctx->u.intf.label_buf;
} else {