]> granicus.if.org Git - sudo/commitdiff
Be careful not to deref user_stat if it is NULL. This cannot currently
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 16 Mar 2011 19:59:44 +0000 (15:59 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 16 Mar 2011 19:59:44 +0000 (15:59 -0400)
happen in sudo but might in other programs using the parser.

plugins/sudoers/match.c

index a3b65de1fcadcedabdf5d217cb07ec968613b135..8e06a4d5c6658efb918a5d0448ededac171aec31 100644 (file)
@@ -580,8 +580,9 @@ command_matches_dir(char *sudoers_dir, size_t dlen)
        if (strcmp(user_base, dent->d_name) != 0 ||
            stat(buf, &sudoers_stat) == -1)
            continue;
-       if (user_stat->st_dev == sudoers_stat.st_dev &&
-           user_stat->st_ino == sudoers_stat.st_ino) {
+       if (user_stat == NULL ||
+           (user_stat->st_dev == sudoers_stat.st_dev &&
+           user_stat->st_ino == sudoers_stat.st_ino)) {
            efree(safe_cmnd);
            safe_cmnd = estrdup(buf);
            break;