Fixed an off-by-one error when dealing with interface name
(if_xname is IFNAMSIZ-sized and NUL-terminated).
This commit is contained in:
parent
c60878f0d2
commit
bbb75d7844
@ -524,12 +524,12 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
}
|
||||
|
||||
case NGM_EIFACE_GET_IFNAME:
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT);
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT);
|
||||
if (resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
strlcpy(resp->data, ifp->if_xname, IFNAMSIZ + 1);
|
||||
strlcpy(resp->data, ifp->if_xname, IFNAMSIZ);
|
||||
break;
|
||||
|
||||
case NGM_EIFACE_GET_IFADDRS:
|
||||
|
@ -420,12 +420,12 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
case NGM_ETHER_COOKIE:
|
||||
switch (msg->header.cmd) {
|
||||
case NGM_ETHER_GET_IFNAME:
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT);
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT);
|
||||
if (resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ + 1);
|
||||
strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ);
|
||||
break;
|
||||
case NGM_ETHER_GET_IFINDEX:
|
||||
NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT);
|
||||
|
@ -406,12 +406,12 @@ ng_gif_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
case NGM_GIF_COOKIE:
|
||||
switch (msg->header.cmd) {
|
||||
case NGM_GIF_GET_IFNAME:
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT);
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT);
|
||||
if (resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ + 1);
|
||||
strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ);
|
||||
break;
|
||||
case NGM_GIF_GET_IFINDEX:
|
||||
NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user