[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. Index: libnfnetlink/src/libnfnetlink.c =================================================================== --- libnfnetlink.orig/src/libnfnetlink.c 2006-02-12 19:24:26.000000000 +0100 +++ libnfnetlink/src/libnfnetlink.c 2006-02-12 19:28:19.000000000 +0100 @@ -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;