summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-04-19 20:18:51 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-04-21 18:07:17 +0300
commit7f457351d2a09013cd57fcb2f95c0d6f56bfaccb (patch)
treeffaa2150b9fe5e161c392f36e0af8cb290a0435c
parentd948dcd9555c81ccb378054383ef8da464202bdf (diff)
xfree86: check for NULL pointer before dereferences it in parser code
Seems to be harmless. Meh. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
-rw-r--r--hw/xfree86/parser/scan.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 8aab0cf41..06710d55a 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -845,10 +845,13 @@ static int
ConfigFilter(const struct dirent *de)
{
const char *name = de->d_name;
- size_t len = strlen(name);
+ size_t len;
size_t suflen = strlen(XCONFIGSUFFIX);
- if (!name || name[0] == '.' || len <= suflen)
+ if (!name || name[0] == '.')
+ return 0;
+ len = strlen(name);
+ if(len <= suflen)
return 0;
if (strcmp(&name[len-suflen], XCONFIGSUFFIX) != 0)
return 0;