]> git.tuebingen.mpg.de Git - adu.git/commitdiff
Fix the uid parser.
authorAndre Noll <maan@systemlinux.org>
Sat, 31 May 2008 18:40:33 +0000 (20:40 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 31 May 2008 18:40:33 +0000 (20:40 +0200)
Using e.g. --uid 42 caused parse_uid_range() to pass a NULL pointer
to check_uid_arg().

adu.c

diff --git a/adu.c b/adu.c
index 8721089f67eec9064967a46b399f02bb284e3613..b7be0696e260ba966b409748e1ecc3e579880388 100644 (file)
--- a/adu.c
+++ b/adu.c
@@ -80,10 +80,8 @@ static int parse_uid_range(const char *orig_arg, struct uid_range *ur)
        int ret;
        char *arg = para_strdup(orig_arg), *p = strchr(arg, '-');
 
        int ret;
        char *arg = para_strdup(orig_arg), *p = strchr(arg, '-');
 
-       if (!p || p == arg) {
-               if (p == arg) /* -42 */
-                       p++;
-               ret = check_uid_arg(p, &ur->high);
+       if (!p || p == arg) { /* -42 or 42 */
+               ret = check_uid_arg(p? p + 1 : arg, &ur->high);
                if (ret < 0)
                        goto out;
                ur->low = p? 0 : ur->high;
                if (ret < 0)
                        goto out;
                ur->low = p? 0 : ur->high;