diff options
author | Karel Zak | 2011-02-21 15:35:04 +0100 |
---|---|---|
committer | Karel Zak | 2011-02-21 15:35:04 +0100 |
commit | 69e433d8d9b19e4a0e3187a77f0813bb040a18b2 (patch) | |
tree | a6a52917cf10d0ab67651d7463ae1dcc41f8f9e6 /lib/strutils.c | |
parent | strutils: new wrapper function strtoll_or_err (diff) | |
download | kernel-qcow2-util-linux-69e433d8d9b19e4a0e3187a77f0813bb040a18b2.tar.gz kernel-qcow2-util-linux-69e433d8d9b19e4a0e3187a77f0813bb040a18b2.tar.xz kernel-qcow2-util-linux-69e433d8d9b19e4a0e3187a77f0813bb040a18b2.zip |
lib: [strutils.c] more robust strtol checks
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/strutils.c')
-rw-r--r-- | lib/strutils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strutils.c b/lib/strutils.c index acb7139dc..21c58daea 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; |