From: Mike Yuan Date: Mon, 8 Apr 2024 12:19:57 +0000 (+0800) Subject: userdbctl: avoid NULL pointer deref X-Git-Tag: v256-rc1~265^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f48b487ddbf6cfc40f7154e06a560ec1bb9ad512;p=thirdparty%2Fsystemd.git userdbctl: avoid NULL pointer deref Error from uid_range_load_userns is ignored, so 'p' could be NULL. --- diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index f98acce29ec..761f1726824 100644 --- a/src/userdb/userdbctl.c +++ b/src/userdb/userdbctl.c @@ -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;