From b36a6e94f8e64d10a41627fe2721a2610683776d Mon Sep 17 00:00:00 2001 From: Paul Chambers Date: Wed, 2 Oct 2019 13:16:29 -0700 Subject: [PATCH] NFT_RULE_USERDATA is sized, not null-terminated. Must use strndup() --- miniupnpd/netfilter_nft/nftnlrdr_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniupnpd/netfilter_nft/nftnlrdr_misc.c b/miniupnpd/netfilter_nft/nftnlrdr_misc.c index 0633fea..1d2fc09 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr_misc.c +++ b/miniupnpd/netfilter_nft/nftnlrdr_misc.c @@ -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,