]> granicus.if.org Git - sudo/commitdiff
Fix a potential crash when a non-regular file is present in an
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 27 Mar 2011 15:02:18 +0000 (11:02 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 27 Mar 2011 15:02:18 +0000 (11:02 -0400)
includedir.  Fixes bz #452

--HG--
branch : 1.7

toke.c
toke.l

diff --git a/toke.c b/toke.c
index 7326b61ec3a240cbd83f07565e950d08d3ef9917..fbc334554cf6aab6a7bdb9da1c2936c35779cc28 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3358,6 +3358,7 @@ switch_dir(stack, dirpath)
        }
        if (stat(path, &sb) != 0 || !S_ISREG(sb.st_mode)) {
            efree(path);
+           path = NULL;
            continue;
        }
        pl = malloc(sizeof(*pl));
diff --git a/toke.l b/toke.l
index 31936ba0c097d4113c0c16a2b80d441bcee0016f..15b3bd6234b315920a5c3e76429c853f73cbc996 100644 (file)
--- a/toke.l
+++ b/toke.l
@@ -660,6 +660,7 @@ switch_dir(stack, dirpath)
        }
        if (stat(path, &sb) != 0 || !S_ISREG(sb.st_mode)) {
            efree(path);
+           path = NULL;
            continue;
        }
        pl = malloc(sizeof(*pl));