From f48b487ddbf6cfc40f7154e06a560ec1bb9ad512 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 8 Apr 2024 20:19:57 +0800 Subject: [PATCH] userdbctl: avoid NULL pointer deref Error from uid_range_load_userns is ignored, so 'p' could be NULL. --- src/userdb/userdbctl.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.47.3