Explorar o código

Stack: Fix OOM check while copying variable attributes

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11591

Credit to oss-fuzz
Stefan Profanter %!s(int64=6) %!d(string=hai) anos
pai
achega
e1a99d91cd
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/server/ua_nodes.c

+ 3 - 0
src/server/ua_nodes.c

@@ -326,6 +326,9 @@ copyCommonVariableAttributes(UA_VariableNode *node,
 
             if(type) {
                 void *dst = UA_Array_new(attr->value.arrayLength, type);
+                if (!dst) {
+                    return UA_STATUSCODE_BADOUTOFMEMORY;
+                }
                 uint8_t *tmpPos = (uint8_t *)dst;
 
                 for(size_t i=0; i<attr->value.arrayLength; i++) {