This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=6f494470644fbedac6242de053af27d520d9928a

commit 6f494470644fbedac6242de053af27d520d9928a
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Mar 7 12:02:43 2025 +0100

    libdpkg: Do not crash on missing sysuser or sysgroup system database files
    
    The check for a NULL out of the file open was lost during a last minute
    refactoring. This causes dpkg to crash when the system does not have yet
    a sysuser (by default /etc/passwd) or sysgroup (by default /etc/group)
    database files on disk yet.
    
    Fixes: commit 850bef3ef2817227ecea47370ee124f9f3bfcf82
    Reported-by: Marc Haber <[email protected]>
---
 lib/dpkg/sysuser.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/dpkg/sysuser.c b/lib/dpkg/sysuser.c
index e7b4030d5..18f54810e 100644
--- a/lib/dpkg/sysuser.c
+++ b/lib/dpkg/sysuser.c
@@ -105,6 +105,8 @@ dpkg_sysuser_find(dpkg_sysuser_match_func *matcher, const 
void *match)
        struct passwd *pw;
 
        fp = dpkg_sysdb_open("DPKG_PATH_PASSWD", DPKG_PATH_PASSWD);
+       if (fp == NULL)
+               return NULL;
        while ((pw = fgetpwent(fp)))
                if (matcher(pw, match))
                        break;
@@ -187,6 +189,8 @@ dpkg_sysgroup_find(dpkg_sysgroup_match_func *matcher, const 
void *match)
        struct group *gr;
 
        fp = dpkg_sysdb_open("DPKG_PATH_GROUP", DPKG_PATH_GROUP);
+       if (fp == NULL)
+               return NULL;
        while ((gr = fgetgrent(fp)))
                if (matcher(gr, match))
                        break;

-- 
Dpkg.Org's dpkg

Reply via email to