From 15d4c239f45c59b77e50701f43443eb33601a5e8 Mon Sep 17 00:00:00 2001 From: Thomas Weißschuh Date: Fri, 6 May 2022 01:06:08 +0200 Subject: userdbctl: initialize parameter `n` for uid_range_load_userns() uid_range_load_userns() dereferences the n parameter. Passing unitialized memory may lead to crashes, for example with version 251rc2-1 on ArchLinux. --- src/userdb/userdbctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/userdb') diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index b299bb8e11..9effb3c61e 100644 --- a/src/userdb/userdbctl.c +++ b/src/userdb/userdbctl.c @@ -431,7 +431,7 @@ static int display_user(int argc, char *argv[], void *userdata) { if (table) { _cleanup_free_ UidRange *uid_range = NULL; int boundary_lines, uid_map_lines; - size_t n_uid_range; + size_t n_uid_range = 0; r = uid_range_load_userns(&uid_range, &n_uid_range, "/proc/self/uid_map"); if (r < 0) @@ -740,7 +740,7 @@ static int display_group(int argc, char *argv[], void *userdata) { if (table) { _cleanup_free_ UidRange *gid_range = NULL; int boundary_lines, gid_map_lines; - size_t n_gid_range; + size_t n_gid_range = 0; r = uid_range_load_userns(&gid_range, &n_gid_range, "/proc/self/gid_map"); if (r < 0) -- cgit v1.2.3