]> The Tcpdump Group git mirrors - libpcap/commitdiff
Linux netfilter queue interface: fix a Coverity warning
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 6 Jan 2015 19:31:20 +0000 (20:31 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 6 Jan 2015 19:31:20 +0000 (20:31 +0100)
The warning was:
CID 1261748:  Explicit null dereferenced  (FORWARD_NULL)
Dereferencing null pointer "nfg".

pcap-netfilter-linux.c

index c086d949959c6359ad08569abfe2b5fe564ba8e6..9e61e455dbfefd34f5fd6d898ab5bb0f97def081 100644 (file)
@@ -196,7 +196,8 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c
                                /* XXX, possible responses: NF_DROP, NF_ACCEPT, NF_STOLEN, NF_QUEUE, NF_REPEAT, NF_STOP */
                                /* if type == NFQUEUE, handle->linktype is always != DLT_NFLOG,
                                   so nfg is always initialized to NLMSG_DATA(nlh). */
-                               nfqueue_send_verdict(handle, ntohs(nfg->res_id), id, NF_ACCEPT);
+                               if (nfg != NULL)
+                                       nfqueue_send_verdict(handle, ntohs(nfg->res_id), id, NF_ACCEPT);
                        }
                }