NFT_RULE_USERDATA is sized, not null-terminated. Must use strndup()

This commit is contained in:
Paul Chambers 2019-10-02 13:16:29 -07:00 committed by Thomas Bernard
parent b6303c8836
commit b36a6e94f8
1 changed files with 1 additions and 1 deletions

View File

@ -597,7 +597,7 @@ table_cb(const struct nlmsghdr *nlh, void *data)
descr = (char *) nftnl_rule_get_data(t, NFTNL_RULE_USERDATA,
&r->desc_len);
if (r->desc_len > 0)
r->desc = strdup(descr);
r->desc = strndup(descr, r->desc_len);
r->handle = *(uint32_t *) nftnl_rule_get_data(t,
NFTNL_RULE_HANDLE,