]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
pwck: fix segfault when calling fprintf() 445/head
authorIker Pedrosa <ipedrosa@redhat.com>
Mon, 15 Nov 2021 11:40:15 +0000 (12:40 +0100)
committerIker Pedrosa <ipedrosa@redhat.com>
Mon, 15 Nov 2021 11:45:08 +0000 (12:45 +0100)
As shadow_logfd variable is not set at the beginning of the program if
something fails and fprintf() is called a segmentation fault happens.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2021339

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
src/pwck.c

index 4248944ae8a37f2e3836c7a12b97036dd101c63a..4ce86af29d0aba0f8e3b35b12b7a9a028b1e9419 100644 (file)
@@ -857,6 +857,7 @@ int main (int argc, char **argv)
         * Get my name so that I can use it to report errors.
         */
        Prog = Basename (argv[0]);
+       shadow_logfd = stderr;
 
        (void) setlocale (LC_ALL, "");
        (void) bindtextdomain (PACKAGE, LOCALEDIR);