Menu

#39 opendkim/opendkim.c:dkimf_securefile(): protect with mutex reading output of getpwuid

2.10.3
open
nobody
None
5
2017-10-21
2017-10-21
No
diff --git a/opendkim/opendkim.c b/opendkim/opendkim.c
--- a/opendkim/opendkim.c
+++ b/opendkim/opendkim.c
@@ -4725,10 +4725,9 @@ dkimf_securefile(const char *path, ino_t *ino, uid_t myuid, char *err,
        if (myuid == (uid_t) -1)
                myuid = pw->pw_uid;

-       pthread_mutex_unlock(&pwdb_lock);
-
 #ifdef HAVE_REALPATH
        strlcpy(myname, pw->pw_name, sizeof myname);
+       pthread_mutex_unlock(&pwdb_lock);

        p = realpath(path, real);
        if (p == NULL)
@@ -4767,6 +4766,7 @@ dkimf_securefile(const char *path, ino_t *ino, uid_t myuid, char *err,

        return 1;
 #else /* HAVE_REALPATH */
+       pthread_mutex_unlock(&pwdb_lock);
        struct stat s;

        status = stat(path, &s);

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.