summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkus <>2008-09-01 09:40:43 +0000
committermarkus <>2008-09-01 09:40:43 +0000
commitcea1f1802d5e0c74b36add3592291987fd02d807 (patch)
tree03ebd2d1fc6d97ad4cbeb29e2bf302601a46c89b /src
parentf1cdd30b5c0055da3d496515af889a0ba4fb6467 (diff)
downloadopenbsd-cea1f1802d5e0c74b36add3592291987fd02d807.tar.gz
openbsd-cea1f1802d5e0c74b36add3592291987fd02d807.tar.bz2
openbsd-cea1f1802d5e0c74b36add3592291987fd02d807.zip
do not overflow for large prefix len (e.g. 2147483649)
report Maksymilian Arciemowicz; ok djm, deraadt
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/net/inet_net_pton.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/net/inet_net_pton.c b/src/lib/libc/net/inet_net_pton.c
index 9bb35478ca..3105c33b43 100644
--- a/src/lib/libc/net/inet_net_pton.c
+++ b/src/lib/libc/net/inet_net_pton.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_net_pton.c,v 1.5 2005/08/06 20:30:03 espie Exp $ */ 1/* $OpenBSD: inet_net_pton.c,v 1.6 2008/09/01 09:40:43 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 by Internet Software Consortium. 4 * Copyright (c) 1996 by Internet Software Consortium.
@@ -142,12 +142,12 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
142 assert(n >= 0 && n <= 9); 142 assert(n >= 0 && n <= 9);
143 bits *= 10; 143 bits *= 10;
144 bits += n; 144 bits += n;
145 if (bits > 32)
146 goto emsgsize;
145 } while ((ch = *src++) != '\0' && 147 } while ((ch = *src++) != '\0' &&
146 isascii(ch) && isdigit(ch)); 148 isascii(ch) && isdigit(ch));
147 if (ch != '\0') 149 if (ch != '\0')
148 goto enoent; 150 goto enoent;
149 if (bits > 32)
150 goto emsgsize;
151 } 151 }
152 152
153 /* Firey death and destruction unless we prefetched EOS. */ 153 /* Firey death and destruction unless we prefetched EOS. */