Fix some issues reported by CodeQL (#3064)
Refer to https://github.com/bytecodealliance/wasm-micro-runtime/pull/2812 and https://github.com/bytecodealliance/wasm-micro-runtime/security/code-scanning?query=pr%3A2812+is%3Aopen
This commit is contained in:
@ -2905,7 +2905,8 @@ copy_string_array(const char *array[], uint32 array_size, char **buf_ptr,
|
||||
/* We add +1 to generate null-terminated array of strings */
|
||||
total_size = sizeof(char *) * ((uint64)array_size + 1);
|
||||
if (total_size >= UINT32_MAX
|
||||
|| (total_size > 0 && !(list = wasm_runtime_malloc((uint32)total_size)))
|
||||
/* total_size must be larger than 0, don' check it again */
|
||||
|| !(list = wasm_runtime_malloc((uint32)total_size))
|
||||
|| buf_size >= UINT32_MAX
|
||||
|| (buf_size > 0 && !(buf = wasm_runtime_malloc((uint32)buf_size)))) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user