Sfoglia il codice sorgente

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 6 anni fa
parent
commit
e1a99d91cd
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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++) {