summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2009-10-21 19:56:46 +0000
committermiod <miod@openbsd.org>2009-10-21 19:56:46 +0000
commit87cb402dc98da6cfba6382dd2ae01c402407cee7 (patch)
treed2f63b6e8d2f53d0b9d08e23bbcaaefb7ae23fd6
parentUnused variable. (diff)
downloadwireguard-openbsd-87cb402dc98da6cfba6382dd2ae01c402407cee7.tar.xz
wireguard-openbsd-87cb402dc98da6cfba6382dd2ae01c402407cee7.zip
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;