3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

monitor: Fix length parameter of strncpy for kernel names

This commit is contained in:
Marcel Holtmann 2019-04-30 16:59:28 +02:00
parent 6ac189315a
commit 1ca82f4e49
2 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ static void genl_parse(uint16_t type, const void *data, uint32_t len,
id = *((uint16_t *) NLA_DATA(nla)); id = *((uint16_t *) NLA_DATA(nla));
break; break;
case CTRL_ATTR_FAMILY_NAME: case CTRL_ATTR_FAMILY_NAME:
strncpy(name, NLA_DATA(nla), GENL_NAMSIZ); strncpy(name, NLA_DATA(nla), GENL_NAMSIZ - 1);
break; break;
} }
} }

View File

@ -4322,7 +4322,7 @@ static void genl_ctrl(struct nlmon *nlmon, const void *data, uint32_t len)
id = *((uint16_t *) NLA_DATA(nla)); id = *((uint16_t *) NLA_DATA(nla));
break; break;
case CTRL_ATTR_FAMILY_NAME: case CTRL_ATTR_FAMILY_NAME:
strncpy(name, NLA_DATA(nla), GENL_NAMSIZ); strncpy(name, NLA_DATA(nla), GENL_NAMSIZ - 1);
break; break;
} }
} }
@ -5055,7 +5055,7 @@ static struct l_io *open_packet(const char *name)
return NULL; return NULL;
} }
strncpy(ifr.ifr_name, name, IFNAMSIZ); strncpy(ifr.ifr_name, name, IFNAMSIZ - 1);
if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) { if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) {
perror("Failed to get monitor index"); perror("Failed to get monitor index");