]> git.ipfire.org Git - pakfire.git/commitdiff
pwd: Check for valid length in sub{u,g}ids
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Aug 2022 11:46:39 +0000 (11:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Aug 2022 11:46:39 +0000 (11:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pwd.c

index 0a4df711649fd7f29e74dd4bf20467244592a989..a1b120eabdc578af6b508cb6d2625ae25cdc8f57 100644 (file)
@@ -206,6 +206,12 @@ static struct pakfire_subuid* pakfire_fgetsubuid(struct pakfire* pakfire, FILE*
                token = strtok_r(NULL, ":", &p);
        }
 
+       // Check if length is greater than zero
+       if (__pakfire_subuid.length == 0) {
+               DEBUG(pakfire, "Length equals zero: %s\n", line);
+               r = 1;
+       }
+
 ERROR:
        if (line)
                free(line);
@@ -314,6 +320,12 @@ static struct pakfire_subgid* pakfire_fgetsubgid(struct pakfire* pakfire, FILE*
                token = strtok_r(NULL, ":", &p);
        }
 
+       // Check if length is greater than zero
+       if (__pakfire_subgid.length == 0) {
+               DEBUG(pakfire, "Length equals zero: %s\n", line);
+               r = 1;
+       }
+
 ERROR:
        if (line)
                free(line);