Fix fuzzer error

pull/15667/head
ncteisen 7 years ago
parent f03344e73a
commit 1b83d32b7d
  1. 4
      src/core/lib/security/util/json_util.cc

@ -29,6 +29,10 @@ const char* grpc_json_get_string_property(const grpc_json* json,
const char* prop_name) { const char* prop_name) {
grpc_json* child; grpc_json* child;
for (child = json->child; child != nullptr; child = child->next) { for (child = json->child; child != nullptr; child = child->next) {
if (child->key == nullptr) {
gpr_log(GPR_ERROR, "Invalid (null) JSON key encountered");
return nullptr;
}
if (strcmp(child->key, prop_name) == 0) break; if (strcmp(child->key, prop_name) == 0) break;
} }
if (child == nullptr || child->type != GRPC_JSON_STRING) { if (child == nullptr || child->type != GRPC_JSON_STRING) {

Loading…
Cancel
Save