From: Karel Zak Date: Mon, 21 Feb 2011 14:35:04 +0000 (+0100) Subject: lib: [strutils.c] more robust strtol checks X-Git-Tag: v2.20-rc1~532 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69e433d8d9b19e4a0e3187a77f0813bb040a18b2;p=thirdparty%2Futil-linux.git lib: [strutils.c] more robust strtol checks Signed-off-by: Karel Zak --- diff --git a/lib/strutils.c b/lib/strutils.c index acb7139dc2..21c58daeac 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -177,7 +177,7 @@ long strtol_or_err(const char *str, const char *errmesg) errno = 0; num = strtol(str, &end, 10); - if (errno || (end && *end)) + if (errno || str == end || (end && *end)) goto err; return num; @@ -201,7 +201,7 @@ long long strtoll_or_err(const char *str, const char *errmesg) errno = 0; num = strtoll(str, &end, 10); - if (errno || (end && *end)) + if (errno || str == end || (end && *end)) goto err; return num;