summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-02-03 12:35:57 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-02-03 14:16:16 +0800
commit8e6a964411ea3e1d7dc4c86c314e326e3be2b0eb (patch)
treecba2318553d1c7942e39e4073438b43fd2d8c7a8 /src/egl
parent2287f4c52ab10a6d65d7bb12803a8ee0f2394699 (diff)
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.
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/main/egldriver.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 8e623a071e..d58991aa4c 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)) {