From 69e433d8d9b19e4a0e3187a77f0813bb040a18b2 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 21 Feb 2011 15:35:04 +0100 Subject: [PATCH] lib: [strutils.c] more robust strtol checks Signed-off-by: Karel Zak --- lib/strutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.47.3