summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/strtonum.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-05-03 20:53:34 +0000
committermillert <millert@openbsd.org>2004-05-03 20:53:34 +0000
commit53aa82ace9347b78a5df981d26eff6053b93d98d (patch)
tree390cb2a4fbdf23c2aec40b3fdc0e81262381fba7 /lib/libc/stdlib/strtonum.c
parentMissed this in the __strerror() removal. (diff)
downloadwireguard-openbsd-53aa82ace9347b78a5df981d26eff6053b93d98d.tar.xz
wireguard-openbsd-53aa82ace9347b78a5df981d26eff6053b93d98d.zip
Be smarter about signed vs. unsigned (produces better error messages).
OK otto@
Diffstat (limited to 'lib/libc/stdlib/strtonum.c')
-rw-r--r--lib/libc/stdlib/strtonum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c
index 9ac0d34ee00..a7f07c9062c 100644
--- a/lib/libc/stdlib/strtonum.c
+++ b/lib/libc/stdlib/strtonum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strtonum.c,v 1.1 2004/05/03 17:09:24 tedu Exp $ */
+/* $OpenBSD: strtonum.c,v 1.2 2004/05/03 20:53:34 millert Exp $ */
/*
* Copyright (c) 2004 Ted Unangst and Todd Miller
* All rights reserved.
@@ -48,7 +48,7 @@ strtonum(const char *numstr, long long minval, unsigned long long maxval,
if (minval > maxval || maxval < minval ||
(minval < 0 && maxval > LLONG_MAX))
error = INVALID;
- else if (minval >= 0) {
+ else if (maxval > LLONG_MAX ) {
ull = strtoull(numstr, &ep, 10);
if (numstr == ep || *ep != '\0')
error = INVALID;