Add NLMSG_OK checking to nfnl_get_msg_next
PATCH 1/3 Add NLMSG_OK checking to nfnl_get_msg_next
nfnl_get_msg_next must check is the message is OK after NLMSG_NEXT is called.
Signature · 1 line
Pablo
[LIBNFNETLINK] Add NLMSG_OK checking to nfnl_get_msg_next
nfnl_get_msg_next must check is the message is OK after NLMSG_NEXT is called.
src/libnfnetlink.c +5 -0
@@ -861,6 +861,11 @@ struct nlmsghdr *nfnl_get_msg_next(struc remain_len = (len - ((unsigned char *)h->last_nlhdr - buf)); nlh =NLMSG_NEXT (h->last_nlhdr, remain_len); +if (!NLMSG_OK (nlh, remain_len)) { + h->last_nlhdr =NULL ; +return NULL ; + } + h->last_nlhdr = nlh;return nlh;
Harald Welte
AppliedQuoted 2 lines · Pablo Neira Ayuso
nfnl_get_msg_nextmust check is the message is OK afterNLMSG_NEXTis called.
thanks, applied.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie