Mesa (master): egl: Fix a potential segfault in driver suffix matching.
Chia-I Wu
olv at kemper.freedesktop.org
Wed Feb 3 06:20:35 UTC 2010
Module: Mesa
Branch: master
Commit: 8e6a964411ea3e1d7dc4c86c314e326e3be2b0eb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e6a964411ea3e1d7dc4c86c314e326e3be2b0eb
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Wed Feb 3 12:35:57 2010 +0800
egl: Fix a potential segfault in driver suffix matching.
The driver suffix might be NULL on some platforms. Perform the matching
only when there is a suffix.
---
src/egl/main/egldriver.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 8e623a0..d58991a 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -347,9 +347,11 @@ _eglPreloadPattern(const char *dir, size_t len, void *preload_data)
if (strncmp(dirent->d_name, prefix, prefix_len) != 0)
continue;
/* match the suffix */
- p = dirent->d_name + dirent_len - suffix_len;
- if (p < dirent->d_name || strcmp(p, suffix) != 0)
- continue;
+ if (suffix) {
+ p = dirent->d_name + dirent_len - suffix_len;
+ if (p < dirent->d_name || strcmp(p, suffix) != 0)
+ continue;
+ }
/* make a full path and load the driver */
if (len + dirent_len + 1 <= sizeof(path)) {
More information about the mesa-commit
mailing list