summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-10-13 17:58:50 +0000
committerJim Meyering <jim@meyering.net>1996-10-13 17:58:50 +0000
commit41dfaf296ad129c3f2d55e9b54158e49d6d35b6f (patch)
treef394de408e4adb96fd8fcb6786336dc41730c907 /lib
parentbc2d814543bc427bd4900abbd0958605fa993248 (diff)
downloadcoreutils-41dfaf296ad129c3f2d55e9b54158e49d6d35b6f.tar.xz
(__xstrtol): Return an error for invalid suffix.
Before, e.g., `split -b 1M' would be silently accepted and treated like `split -b 1'. Reported by Franc,ois.
Diffstat (limited to 'lib')
-rw-r--r--lib/xstrtol.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index 8755cf475..dec0ec79b 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -102,8 +102,11 @@ __xstrtol (s, ptr, base, val, valid_suffixes)
return LONGINT_INVALID_SUFFIX_CHAR;
}
- if (**p != '\0' && strchr (valid_suffixes, **p))
+ if (**p != '\0')
{
+ if (!strchr (valid_suffixes, **p))
+ return LONGINT_INVALID_SUFFIX_CHAR;
+
switch (**p)
{
case 'b':