summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotto <>2004-07-16 18:36:05 +0000
committerotto <>2004-07-16 18:36:05 +0000
commitf32fd4b24aca380e452786ba0c17e1c3a1d2b780 (patch)
tree09450471b93ad8a3506282677c26f4a5bfdd4613
parent5324f527aa491efaf55f123392b79694bc7fca89 (diff)
downloadopenbsd-f32fd4b24aca380e452786ba0c17e1c3a1d2b780.tar.gz
openbsd-f32fd4b24aca380e452786ba0c17e1c3a1d2b780.tar.bz2
openbsd-f32fd4b24aca380e452786ba0c17e1c3a1d2b780.zip
Do not forget to test the lower bound if the upper bound > LLONG_MAX.
ok millert@
-rw-r--r--src/lib/libc/stdlib/strtonum.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/strtonum.c b/src/lib/libc/stdlib/strtonum.c
index 4c41c22b8b..a2dfed25ca 100644
--- a/src/lib/libc/stdlib/strtonum.c
+++ b/src/lib/libc/stdlib/strtonum.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strtonum.c,v 1.4 2004/07/16 16:03:36 millert Exp $ */ 1/* $OpenBSD: strtonum.c,v 1.5 2004/07/16 18:36:05 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2004 Ted Unangst and Todd Miller 3 * Copyright (c) 2004 Ted Unangst and Todd Miller
4 * All rights reserved. 4 * All rights reserved.
@@ -55,6 +55,8 @@ strtonum(const char *numstr, long long minval, unsigned long long umaxval,
55 else if ((ull == ULLONG_MAX && errno == ERANGE) || 55 else if ((ull == ULLONG_MAX && errno == ERANGE) ||
56 ull > umaxval) 56 ull > umaxval)
57 error = TOOLARGE; 57 error = TOOLARGE;
58 else if (ull < minval)
59 error = TOOSMALL;
58 } else { 60 } else {
59 if (minval > maxval || maxval < minval) { 61 if (minval > maxval || maxval < minval) {
60 error = INVALID; 62 error = INVALID;