]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
groupdel: fix SIGSEGV when passwd does not exist 435/head
authorFrançois Rigault <frigo@amadeus.com>
Mon, 1 Nov 2021 12:54:25 +0000 (13:54 +0100)
committerFrançois Rigault <frigo@amadeus.com>
Mon, 1 Nov 2021 12:54:25 +0000 (13:54 +0100)
When using groupdel with a prefix, groupdel will attempt to read a
passwd file to look for any user in the group. When the file does not
exist it cores with segmentation fault.

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

libmisc/prefix_flag.c

index cca553a5bdf3da4a2284cb0f2f205cd33c148e61..b6628ac492669b8b6bd6ab615eb8945e0585ba5d 100644 (file)
@@ -288,6 +288,9 @@ extern struct passwd* prefix_getpwent()
        if (!passwd_db_file) {
                return getpwent();
        }
+       if (!fp_pwent) {
+               return NULL;
+       }
        return fgetpwent(fp_pwent);
 }
 extern void prefix_endpwent()