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 | 06560e9c0e60fa994f489018fd9c35509d3bad0b (patch) | |
tree | efe100cef2037cfe634617270d8f0d41817dcf1b | |
parent | 040465a37255f92b50ce7b3e46e8e610addf18d3 (diff) | |
download | gnulib-06560e9c0e60fa994f489018fd9c35509d3bad0b.tar.gz |
(__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.
-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 8755cf475d..dec0ec79be 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': |