summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/egl/main/eglarray.c5
1 files changed, 4 insertions, 1 deletions
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));