From d7284b45e247d620e3a80bfc9182ff9c45bb7c62 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 15 Jul 2010 00:31:39 +0800 Subject: egl: Return the correct array size in _eglFlattenArray. The function is used by _eglGetConfigs and _eglGetScreens. The array size should not be limited by the buffer size when the buffer is NULL. This fixes fdo bug #29052. --- src/egl/main/eglarray.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/egl/main') diff --git a/src/egl/main/eglarray.c b/src/egl/main/eglarray.c index 781d07fc1c..d686fa162d 100644 --- a/src/egl/main/eglarray.c +++ b/src/egl/main/eglarray.c @@ -166,8 +166,11 @@ _eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, if (!array) return 0; - count = (size < array->Size) ? size : array->Size; + count = array->Size; if (buffer) { + /* do not exceed buffer size */ + if (count > size) + count = size; for (i = 0; i < count; i++) flatten(array->Elements[i], (void *) ((char *) buffer + elem_size * i)); -- cgit v1.2.3