Przeglądaj źródła

Stack: Fix invalid memory access if OOM

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

Credit to oss-fuzz
Stefan Profanter 6 lat temu
rodzic
commit
f4f1c7b447
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      plugins/ua_config_default.c

+ 1 - 1
plugins/ua_config_default.c

@@ -347,12 +347,12 @@ UA_ServerConfig_new_customBuffer(UA_UInt16 portNumber,
     }
 
     /* Allocate the endpoint */
-    conf->endpointsSize = 1;
     conf->endpoints = (UA_Endpoint *)UA_malloc(sizeof(UA_Endpoint));
     if(!conf->endpoints) {
         UA_ServerConfig_delete(conf);
         return NULL;
     }
+    conf->endpointsSize = 1;
 
     /* Populate the endpoint */
     UA_ByteString localCertificate = UA_BYTESTRING_NULL;