diff options
author | Jim Meyering <jim@meyering.net> | 1996-10-13 17:58:50 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-10-13 17:58:50 +0000 |
commit | 41dfaf296ad129c3f2d55e9b54158e49d6d35b6f (patch) | |
tree | f394de408e4adb96fd8fcb6786336dc41730c907 /lib | |
parent | bc2d814543bc427bd4900abbd0958605fa993248 (diff) | |
download | coreutils-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.c | 5 |
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': |