diff options
author | Nicolas François <nicolas.francois@centraliens.net> | 2013-08-15 17:07:04 +0200 |
---|---|---|
committer | Nicolas François <nicolas.francois@centraliens.net> | 2013-08-15 17:30:19 +0200 |
commit | 2e46882a9b3b700b75c8574a3cf73078e27c56fb (patch) | |
tree | 4af773c3508cfcc13e470e15c0b9412d84d795f6 | |
parent | 5917347c6ffc0f8a7d7bc2cb640600024a2552d6 (diff) |
Fix parse of ranges.
* src/usermod.c: Fix parse of ranges. The hyphen might be followed
by a negative integer.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/usermod.c | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2013-08-15 Nicolas François <nicolas.francois@centraliens.net> + * src/usermod.c: Fix parse of ranges. The hyphen might be followed + by a negative integer. + +2013-08-15 Nicolas François <nicolas.francois@centraliens.net> + * lib/subordinateio.c (find_free_range): max is allowed for new ranges. diff --git a/src/usermod.c b/src/usermod.c index 250ac1a7..5f5838dc 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -336,7 +336,7 @@ struct ulong_range static struct ulong_range getulong_range(const char *str) { struct ulong_range result = { .first = ULONG_MAX, .last = 0 }; - unsigned long long first, last; + long long first, last; char *pos; errno = 0; @@ -346,7 +346,7 @@ static struct ulong_range getulong_range(const char *str) goto out; errno = 0; - last = strtoul(pos + 1, &pos, 10); + last = strtoll(pos + 1, &pos, 10); if (('\0' != *pos ) || (ERANGE == errno) || (last != (unsigned long int)last)) goto out; |