]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
userdbctl: avoid NULL pointer deref
authorMike Yuan <me@yhndnzj.com>
Mon, 8 Apr 2024 12:19:57 +0000 (20:19 +0800)
committerMike Yuan <me@yhndnzj.com>
Mon, 8 Apr 2024 12:20:26 +0000 (20:20 +0800)
Error from uid_range_load_userns is ignored,
so 'p' could be NULL.

src/userdb/userdbctl.c

index f98acce29ec3e938ee3d3426dee7f74b7d60755a..761f172682495f28541431ef63f2d622358ff00e 100644 (file)
@@ -310,6 +310,9 @@ static int table_add_uid_map(
         assert(table);
         assert(add_unavailable);
 
+        if (!p)
+                return 0;
+
         for (size_t i = 0; p && i < p->n_entries; i++) {
                 UIDRangeEntry *x = p->entries + i;