Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/inet Check bits on each loop to prevent integer ove...
details: https://anonhg.NetBSD.org/src/rev/106fe234613b
branches: trunk
changeset: 762950:106fe234613b
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 06 16:00:20 2011 +0000
description:
Check bits on each loop to prevent integer oveflow.
Reported by Maksymilian Arciemowicz
diffstat:
lib/libc/inet/inet_net_pton.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 7583bb90661a -r 106fe234613b lib/libc/inet/inet_net_pton.c
--- a/lib/libc/inet/inet_net_pton.c Sun Mar 06 16:00:16 2011 +0000
+++ b/lib/libc/inet/inet_net_pton.c Sun Mar 06 16:00:20 2011 +0000
@@ -20,7 +20,7 @@
#if 0
static const char rcsid[] = "Id: inet_net_pton.c,v 1.4.2.1 2002/08/02 02:17:21 marka Exp ";
#else
-__RCSID("$NetBSD: inet_net_pton.c,v 1.1 2004/05/20 23:13:02 christos Exp $");
+__RCSID("$NetBSD: inet_net_pton.c,v 1.2 2011/03/06 16:00:20 christos Exp $");
#endif
#endif
@@ -145,12 +145,12 @@
INSIST(n >= 0 && n <= 9);
bits *= 10;
bits += n;
+ if (bits > 32)
+ goto emsgsize;
} while ((ch = *src++) != '\0' && isascii((u_char)ch)
&& isdigit((u_char)ch));
if (ch != '\0')
goto enoent;
- if (bits > 32)
- goto emsgsize;
}
/* Firey death and destruction unless we prefetched EOS. */
Home |
Main Index |
Thread Index |
Old Index