summaryrefslogtreecommitdiffstats
path: root/src/userdb
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2022-05-06 01:06:08 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-05-06 06:48:51 +0200
commit15d4c239f45c59b77e50701f43443eb33601a5e8 (patch)
tree0b7d7a63c5869e50fa24c7f682057764aee5ba35 /src/userdb
parentMerge pull request #23277 from keszybz/news-and-hwdb-update (diff)
downloadsystemd-15d4c239f45c59b77e50701f43443eb33601a5e8.tar.xz
systemd-15d4c239f45c59b77e50701f43443eb33601a5e8.zip
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.
Diffstat (limited to 'src/userdb')
-rw-r--r--src/userdb/userdbctl.c4
1 files changed, 2 insertions, 2 deletions
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)