diff --git a/ChangeLog b/ChangeLog index 910d02f1..acee091b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-08-15 Nicolas François + + * src/usermod.c: Fix parse of ranges. The hyphen might be followed + by a negative integer. + 2013-08-15 Nicolas François * lib/subordinateio.c (find_free_range): max is allowed for new 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;