未验证 提交 cf6b0596 编写于 作者: W wanderingbort 提交者: GitHub

Merge pull request #3707 from EOSIO/wasm_memcmp_sanitize

Sanitize the return value of memcmp() to wasm
......@@ -1281,7 +1281,12 @@ class memory_api : public context_aware_api {
}
int memcmp( array_ptr<const char> dest, array_ptr<const char> src, size_t length) {
return ::memcmp(dest, src, length);
int ret = ::memcmp(dest, src, length);
if(ret < 0)
return -1;
if(ret > 0)
return 1;
return 0;
}
char* memset( array_ptr<char> dest, int value, size_t length ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册