From e27ad0abc31f9146fad7bfa9dec9a2069e5d3e2e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 27 Mar 2011 11:02:18 -0400 Subject: [PATCH] Fix a potential crash when a non-regular file is present in an includedir. Fixes bz #452 --HG-- branch : 1.7 --- toke.c | 1 + toke.l | 1 + 2 files changed, 2 insertions(+) diff --git a/toke.c b/toke.c index 7326b61ec..fbc334554 100644 --- 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 31936ba0c..15b3bd623 100644 --- 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)); -- 2.40.0