diff options
author | Cy Schubert <cy@FreeBSD.org> | 2019-12-20 15:38:11 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2019-12-20 15:38:11 +0000 |
commit | ac6f714ee9819bbb28c6d96f2e7186e2f8f2c7f0 (patch) | |
tree | 1ef9f6b7e5b95a2d447d52667df9596fcd5568c2 /net/libpcap/files/patch-nametoaddr.c | |
parent | security/openssl: Security update to 1.0.2u (diff) |
Fix libpcap issue #893: check for invalid IPv4 addresses.
This fixes errors such as:
tcpdump -i lagg0 net 999.999.999.999
This was originally discovered on a Red Hat 7.7 server and verified
to also be a bug on FreeBSD.
PR: 242719
Submitted by: cy
Reported by: cy
Approved by: garga (maintainer)
Obtained from: https://github.com/the-tcpdump-group/libpcap/commit/ \
07070918d5e81a515315b395f334e52589fe0fb
Fixed by: https://github.com/guyharris
Diffstat (limited to 'net/libpcap/files/patch-nametoaddr.c')
-rw-r--r-- | net/libpcap/files/patch-nametoaddr.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/libpcap/files/patch-nametoaddr.c b/net/libpcap/files/patch-nametoaddr.c new file mode 100644 index 000000000000..a501d89a31d7 --- /dev/null +++ b/net/libpcap/files/patch-nametoaddr.c @@ -0,0 +1,21 @@ +diff --git a/nametoaddr.c b/nametoaddr.c +index 53070a28..13bf4c68 100644 +--- nametoaddr.c ++++ nametoaddr.c +@@ -674,8 +674,15 @@ __pcap_atoin(const char *s, bpf_u_int32 *addr) + len = 0; + for (;;) { + n = 0; +- while (*s && *s != '.') ++ while (*s && *s != '.') { ++ if (n > 25) { ++ /* The result will be > 255 */ ++ return -1; ++ } + n = n * 10 + *s++ - '0'; ++ } ++ if (n > 255) ++ return -1; + *addr <<= 8; + *addr |= n & 0xff; + len += 8; |