浏览代码

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 年之前
父节点
当前提交
f4f1c7b447
共有 1 个文件被更改,包括 1 次插入1 次删除
  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;