update test/fuzztest/fuzztest_application/bundleinstalldhost_fuzzer/bundleinstalldhost_fuzzer.cpp.

Signed-off-by: Lotol <linxiangzhi@huawei.com>
This commit is contained in:
Lotol 2023-10-07 09:15:16 +00:00 committed by Gitee
parent f1ba7534dc
commit 3f280997ba
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -58,6 +58,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
return 0;
}
if (size < OHOS::U32_AT_SIZE) {
return 0;
}
/* Validate the length of size */
if (size > OHOS::FOO_MAX_LEN) {
return 0;
}
char* ch = static_cast<char*>(malloc(size + 1));
if (ch == nullptr) {
return 0;