expect: parse_mnl: fix gcc compile warning
Pablo Neira Ayuso
maintainerPATCH 1/1 expect: parse_mnl: fix gcc compile warning
parse_mnl.c: In function ‘nfexp_nlmsg_parse’:
parse_mnl.c:142:3: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
142 | strncpy(exp->helper_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
143 | mnl_attr_get_str(tb[CTA_EXPECT_HELP_NAME]),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144 | NFCT_HELPER_NAME_MAX);
| ~~~~~~~~~~~~~~~~~~~~~Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/expect/parse_mnl.c | 1 + 1 file changed, 1 insertion(+)
src/expect/parse_mnl.c +1 -0
@@ -142,6 +142,7 @@ int nfexp_nlmsg_parse(const struct nlmsghdr *nlh, struct nf_expect *exp)strncpy (exp->helper_name,mnl_attr_get_str (tb[CTA_EXPECT_HELP_NAME ]),NFCT_HELPER_NAME_MAX ); + exp->helper_name[NFCT_HELPER_NAME_MAX -1 ] ='\0' ;set_bit (ATTR_EXP_HELPER_NAME , exp->set); }if (tb[CTA_EXPECT_CLASS ]) {
Signature · 1 line
2.11.0