]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib: [strutils.c] more robust strtol checks
authorKarel Zak <kzak@redhat.com>
Mon, 21 Feb 2011 14:35:04 +0000 (15:35 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2011 12:33:53 +0000 (14:33 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/strutils.c

index b63eea4690e76d43b278f339be85acbd2686144a..a6105489facc867fc72a6e564825ea23716b63ed 100644 (file)
@@ -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;