On Jan 27, 2015, at 1:58 AM, PEUGNEZ Baptiste <baptiste.peug...@cea.fr> wrote:
> I do computer security studies and I wanted to test Coverity, a source code > analysis tool. If you're interested, I corrected a problem in /pcap-linux.c/ > file: uninitialized variable (/req.tp_frame_size/). > > You will find above the Github commit. > > https://github.com/peugnezb/libpcap/commit/2bbb0d9f3e1f0337985b4fa8033d465e598ecc46 Adding the check should be harmless. However, the error message should probably be something such as "internal error: unknown TPACKET_ value XXX", where XXX is the value of handlep->tp_version, because, in the current code, that would happen only if handlep->tp_version had never been set - it's never set to a value other than TPACKET_V1, TPACKET_V2, or TPACKET_V3, and it's only set to TPACKET_V3 if HAVE_TPACKET3 is defined and only set to TPACKET_V2 if HAVE_TPACKET2 is defined (set by init_tpacket()), so the default case in that switch should never be reached. That error message would make it clearer that either 1) some weird glitch happened in the hardware or in some software outside libpcap or 2) there's a case that the analysis above missed, and would give some data that would help figure out which of those is the case. (Sadly, most compilers don't do enough data flow analysis to either prove that it can't happen without a hardware glitch or random out-of-bounds store or to show how it *can* happen and thus to show where the code needs to be fixed.) _______________________________________________ tcpdump-workers mailing list tcpdump-workers@lists.tcpdump.org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers