Explorar el Código

add a maximum size check for UA_Array_new

Julius Pfrommer hace 8 años
padre
commit
5c5066baee
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      src/ua_types.c

+ 2 - 0
src/ua_types.c

@@ -981,6 +981,8 @@ UA_delete(void *p, const UA_DataType *type) {
 
 void *
 UA_Array_new(size_t size, const UA_DataType *type) {
+    if(size > UA_INT32_MAX)
+        return NULL;
     if(size == 0)
         return UA_EMPTY_ARRAY_SENTINEL;
     return UA_calloc(size, type->memSize);