Explorar o código

add a maximum size check for UA_Array_new

Julius Pfrommer %!s(int64=8) %!d(string=hai) anos
pai
achega
5c5066baee
Modificáronse 1 ficheiros con 2 adicións e 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);