aboutsummaryrefslogtreecommitdiffstats
path: root/nametoaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'nametoaddr.c')
-rw-r--r--nametoaddr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/nametoaddr.c b/nametoaddr.c
index 7c48bd3a3513..34a8b5593a64 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -653,8 +653,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;