]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
useradd: fix uninitialized flags causing aarch64 failure
authorIker Pedrosa <ipedrosa@redhat.com>
Tue, 25 Nov 2025 08:52:03 +0000 (09:52 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Fri, 5 Dec 2025 12:40:08 +0000 (13:40 +0100)
Initialize option_flags structure to prevent garbage memory values in
`flags.chroot` and `flags.prefix` fields. Uninitialized memory caused
architecture-specific failures where process_selinux evaluation
differed between x86_64 and aarch64, leading to `pw_close()` failures
when SELinux contexts weren't properly managed.

Fixes: c0c9485d (2025-04-25; "src/useradd.c: chroot or prefix SELinux file context")
Link: <https://bodhi.fedoraproject.org/updates/FEDORA-2025-3d835cfb15>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
src/useradd.c

index 7cce5b703dc0b68f4e38fd8599f1442222ea3907..e9bec7c6163a7678b83bb1106ca1beca9a5aa142 100644 (file)
@@ -2443,7 +2443,10 @@ int main (int argc, char **argv)
 #endif
        unsigned long subuid_count = 0;
        unsigned long subgid_count = 0;
-       struct option_flags  flags;
+       struct option_flags  flags = {
+               .chroot = false,
+               .prefix = false,
+       };
        bool process_selinux;
 
        log_set_progname(Prog);