Change #262304
| Category | tcpdump |
| Changed by | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> |
| Changed at | Wed 25 Mar 2026 13:53:33 |
| Repository | https://git.tcpdump.org/tcpdump |
| Project | tcpdump |
| Branch | master |
| Revision | f15ade2a825c1544922e442f51986aa2c54c6f3b |
Comments
tcpdump: Fix a warning about use of a possibly-NULL pointer
Found with GCC option -fanalyzer.
The error was:
tcpdump.c: In function 'open_interface':
tcpdump.c:1251:13: warning: use of possibly-NULL 'device' where
non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
1251 | if (strncmp(device, rpcap_prefix, sizeof(rpcap_prefix) \
- 1) == 0 ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
In file included from ../libpcap/pcap/pcap-inttypes.h:98,
from netdissect-stdinc.h:78,
from tcpdump.c:41:
/usr/include/string.h:159:12: note: argument 1 of 'strncmp' must be
non-null
159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
| ^~~~~~~
Changed files
- tcpdump.c