summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2006-10-13 15:36:57 +0000
committerreyk <reyk@openbsd.org>2006-10-13 15:36:57 +0000
commit10053aa304fde724db04c63bf7fd46f1a9197398 (patch)
treed0237695d57e95867ec176e695181acc7dbffe86
parentfix fortran man year (diff)
downloadwireguard-openbsd-10053aa304fde724db04c63bf7fd46f1a9197398.tar.xz
wireguard-openbsd-10053aa304fde724db04c63bf7fd46f1a9197398.zip
check error condition of strtonum
-rw-r--r--usr.sbin/hostapd/parse.y10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/hostapd/parse.y b/usr.sbin/hostapd/parse.y
index 317093aab2e..d6b66d5768b 100644
--- a/usr.sbin/hostapd/parse.y
+++ b/usr.sbin/hostapd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.25 2006/09/28 17:06:54 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.26 2006/10/13 15:36:57 reyk Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -1011,7 +1011,13 @@ randaddr : RANDOM
number : STRING
{
- $$ = strtonum($1, 0, LONG_MAX, NULL);
+ const char *errstr;
+ $$ = strtonum($1, 0, LONG_MAX, &errstr);
+ if (errstr) {
+ yyerror("invalid number: %s", $1);
+ free($1);
+ YYERROR;
+ }
free($1);
}
;