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.
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));