Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/lib/libc/net Pull up revision 1.14 (requested by is):
details: https://anonhg.NetBSD.org/src/rev/31c800430935
branches: netbsd-1-4
changeset: 469714:31c800430935
user: he <he%NetBSD.org@localhost>
date: Sat Nov 20 17:10:30 1999 +0000
description:
Pull up revision 1.14 (requested by is):
Do proper overflow checking of IPv4 addresses, fixing PR#8314.
diffstat:
lib/libc/net/inet_pton.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (49 lines):
diff -r feadb2345475 -r 31c800430935 lib/libc/net/inet_pton.c
--- a/lib/libc/net/inet_pton.c Sat Nov 20 16:59:33 1999 +0000
+++ b/lib/libc/net/inet_pton.c Sat Nov 20 17:10:30 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inet_pton.c,v 1.9.2.2 1999/11/05 07:34:20 cgd Exp $ */
+/* $NetBSD: inet_pton.c,v 1.9.2.3 1999/11/20 17:10:30 he Exp $ */
/* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -21,7 +21,7 @@
#if 0
static char rcsid[] = "Id: inet_pton.c,v 8.7 1996/08/05 08:31:35 vixie Exp ";
#else
-__RCSID("$NetBSD: inet_pton.c,v 1.9.2.2 1999/11/05 07:34:20 cgd Exp $");
+__RCSID("$NetBSD: inet_pton.c,v 1.9.2.3 1999/11/20 17:10:30 he Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -140,6 +140,7 @@
* a.b.c.d
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
+ * a (with a treated as 32 bits)
*/
if (pp >= parts + 3)
return (0);
@@ -167,19 +168,19 @@
break;
case 2: /* a.b -- 8.24 bits */
- if (val > 0xffffff)
+ if (parts[0] > 0xff || val > 0xffffff)
return (0);
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
- if (val > 0xffff)
+ if ((parts[0] | parts[1]) > 0xff || val > 0xffff)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
- if (val > 0xff)
+ if ((parts[0] | parts[1] | parts[2] | val) > 0xff)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
Home |
Main Index |
Thread Index |
Old Index