]> granicus.if.org Git - shadow/commitdiff
Fix parse of ranges.
authorNicolas François <nicolas.francois@centraliens.net>
Thu, 15 Aug 2013 15:07:04 +0000 (17:07 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Thu, 15 Aug 2013 15:30:19 +0000 (17:30 +0200)
* src/usermod.c: Fix parse of ranges. The hyphen might be followed
by a negative integer.

ChangeLog
src/usermod.c

index 910d02f14440e1c46d6550434f83b47e756f0ec1..acee091bf989a009a9cb901fd838541d81e4e0d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 250ac1a7f28c88bc97133a51f8ec71e2843ad011..5f5838dcd458a19a9362b51985e374462708fa14 100644 (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;