Fix parse of ranges.

* src/usermod.c: Fix parse of ranges. The hyphen might be followed
	by a negative integer.
This commit is contained in:
Nicolas François 2013-08-15 17:07:04 +02:00
parent 5917347c6f
commit 2e46882a9b
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -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;