egl: don't allow eglGetConfigs to set num_configs param to a negative value
[mesa.git] / src / egl / main / eglarray.c
index 3ccc8a649f0e545bacb53ddbe4f5b63eb9c98401..d2f39af49a677df61e3963c724c034a66fe2b9f1 100644 (file)
@@ -197,6 +197,9 @@ _eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size,
 
    count = array->Size;
    if (buffer) {
+      /* clamp size to 0 */
+      if (size < 0)
+         size = 0;
       /* do not exceed buffer size */
       if (count > size)
          count = size;