summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-10-21 19:56:47 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-10-21 19:56:47 +0000
commitc01b1bf1af4f1e08f1051eec416981fc16dbb54c (patch)
tree4212f5817c3c4b477f232c115d6f3cbec88f55fe
parent938a76644489d9170c4cebf2ea556029aeccbdf4 (diff)
In atoi(), only check for a base indication iff the string starts with `0'
and no base has been enforced. Otherwise the leading number of the mec(4) 08:00:69:xx:yy:zz Ethernet address would be interpreted as octal base, followed by an out-of-range `8' which is now rejected but incorrectly skipped; noticed by maja@
-rw-r--r--sys/arch/sgi/sgi/autoconf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/sgi/sgi/autoconf.c b/sys/arch/sgi/sgi/autoconf.c
index 872fc644452..813bccf7f10 100644
--- a/sys/arch/sgi/sgi/autoconf.c
+++ b/sys/arch/sgi/sgi/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.23 2009/10/16 00:15:49 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.24 2009/10/21 19:56:46 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
*
@@ -521,7 +521,7 @@ atoi(const char *s, int b, const char **o)
}
/* Parse base specification, if any. */
- if (c == '0') {
+ if (base == 0 && c == '0') {
c = *s++;
switch (c) {
case 'X':
@@ -549,11 +549,11 @@ atoi(const char *s, int b, const char **o)
d = c - 'A' + 10;
else
break;
- c = *s++;
if (d >= base)
break;
val *= base;
val += d;
+ c = *s++;
}
if (neg)
val = -val;