From: Pierangelo Masarati Date: Tue, 25 Apr 2006 15:46:44 +0000 (+0000) Subject: fix strtoul() odd interface X-Git-Tag: OPENLDAP_REL_ENG_2_4_1ALPHA~2^2~152 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=716d1770a2b3c1220af255fc36aecd2f8389e898;p=openldap fix strtoul() odd interface --- diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index cb92e59f24..0da7df4790 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -362,6 +362,11 @@ lutil_atoux( unsigned *v, const char *s, int x ) assert( s != NULL ); assert( v != NULL ); + /* strtoul() has an odd interface */ + if ( s[ 0 ] == '-' ) { + return -1; + } + u = strtoul( s, &next, x ); if ( next == s || next[ 0 ] != '\0' ) { return -1; @@ -404,6 +409,11 @@ lutil_atoulx( unsigned long *v, const char *s, int x ) assert( s != NULL ); assert( v != NULL ); + /* strtoul() has an odd interface */ + if ( s[ 0 ] == '-' ) { + return -1; + } + ul = strtoul( s, &next, x ); if ( next == s || next[ 0 ] != '\0' ) { return -1; @@ -433,6 +443,11 @@ lutil_parse_time( unsigned long u; char *what; + /* strtoul() has an odd interface */ + if ( s[ 0 ] == '-' ) { + return -1; + } + u = strtoul( s, &next, 10 ); if ( next == s ) { return -1;