libnfnetlink: BAD_SIZEOF
PATCH 1/1 libnfnetlink: BAD_SIZEOF
static analysis (analysis based only on compiling of sources, not based on running of binary) of the code revealed the following problem:
libnfnetlink.c:481: Taking the size of pointer parameter "nlh" is suspicious. libnfnetlink.c:486: Taking the size of pointer parameter "nlh" is suspicious.
--- src/libnfnetlink.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
src/libnfnetlink.c +2 -2
@@ -477,12 +477,12 @@ nfnl_parse_hdr(const struct nfnl_handle *nfnlh,if (nlh->nlmsg_len ==NLMSG_LENGTH (sizeof (struct nfgenmsg ))) {if (genmsg) - *genmsg = (void *)nlh +sizeof (nlh); + *genmsg = (void *)nlh +sizeof (*nlh);return NULL ; }if (genmsg) - *genmsg = (void *)nlh +sizeof (nlh); + *genmsg = (void *)nlh +sizeof (*nlh);return (void *)nlh +NLMSG_LENGTH (sizeof (struct nfgenmsg )); }
Signature · 1 line
1.7.5.2
Quoted 5 lines · Jiri Popelka
static analysis (analysis based only on compiling of sources, not based on running of binary) of the code revealed the following problem:
libnfnetlink.c:481: Taking the size of pointer parameter "nlh" is suspicious. libnfnetlink.c:486: Taking the size of pointer parameter "nlh" is suspicious.
Applied, thanks Jiri.