diff options
author | 2004-07-16 18:36:05 +0000 | |
---|---|---|
committer | 2004-07-16 18:36:05 +0000 | |
commit | 962c562ea16ecc35f6cc8720e5fd6c4fb50b3c63 (patch) | |
tree | e7975a07a1be2265b86d8c5263e4d15c28617099 /lib/libc/stdlib/strtonum.c | |
parent | dothan est support, from some netbsd guy, tedu ok (diff) | |
download | wireguard-openbsd-962c562ea16ecc35f6cc8720e5fd6c4fb50b3c63.tar.xz wireguard-openbsd-962c562ea16ecc35f6cc8720e5fd6c4fb50b3c63.zip |
Do not forget to test the lower bound if the upper bound > LLONG_MAX.
ok millert@
Diffstat (limited to 'lib/libc/stdlib/strtonum.c')
-rw-r--r-- | lib/libc/stdlib/strtonum.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c index 4c41c22b8b1..a2dfed25caf 100644 --- a/lib/libc/stdlib/strtonum.c +++ b/lib/libc/stdlib/strtonum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtonum.c,v 1.4 2004/07/16 16:03:36 millert Exp $ */ +/* $OpenBSD: strtonum.c,v 1.5 2004/07/16 18:36:05 otto Exp $ */ /* * Copyright (c) 2004 Ted Unangst and Todd Miller * All rights reserved. @@ -55,6 +55,8 @@ strtonum(const char *numstr, long long minval, unsigned long long umaxval, else if ((ull == ULLONG_MAX && errno == ERANGE) || ull > umaxval) error = TOOLARGE; + else if (ull < minval) + error = TOOSMALL; } else { if (minval > maxval || maxval < minval) { error = INVALID; |