From a757b458ffb4fb9a40bcbb4f7869449431c67f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Rigault?= Date: Mon, 1 Nov 2021 13:54:25 +0100 Subject: [PATCH] groupdel: fix SIGSEGV when passwd does not exist 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmisc/prefix_flag.c b/libmisc/prefix_flag.c index cca553a5..b6628ac4 100644 --- a/libmisc/prefix_flag.c +++ b/libmisc/prefix_flag.c @@ -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()