[PATCH] xfree86: check for NULL pointer before dereferences it in parser code
Tiago Vignatti
tiago.vignatti at nokia.com
Mon Apr 19 10:58:02 PDT 2010
Seems to be harmless. Meh.
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
hw/xfree86/parser/scan.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 8aab0cf..06710d5 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;
--
1.6.0.4
More information about the xorg-devel
mailing list