diff --git a/interfaces/kits/cj/src/config_policy_ffi.cpp b/interfaces/kits/cj/src/config_policy_ffi.cpp index 6997cd810dfa055c647c6b636fef066fe1861bbc..3af9e30f524d2cb74e79ae3bcc3776dab0e32f09 100644 --- a/interfaces/kits/cj/src/config_policy_ffi.cpp +++ b/interfaces/kits/cj/src/config_policy_ffi.cpp @@ -31,7 +31,7 @@ char** MallocCStringArr(const std::vector& origin) return nullptr; } auto size = origin.size(); - if (size > MAX_MALLOC_LEN) { + if (size == 0 || size > MAX_MALLOC_LEN) { return nullptr; } auto arr = static_cast(malloc(sizeof(char*) * size));