Skip to content

Commit 7a09456

Browse files
Fix null pointer issuer in unmarshal_values
Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
1 parent 3565008 commit 7a09456

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ecc_enclave/enclave/shim.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,15 @@ int unmarshal_values(
192192
{
193193
JSON_Object* pair = json_array_get_object(pairs, i);
194194
const char* key = json_object_get_string(pair, "key");
195+
if (key == NULL) {
196+
LOG_ERROR("Shim: Cannot parse json: key does not exists");
197+
return -1;
198+
}
195199
const char* b64value = json_object_get_string(pair, "value");
200+
if (b64value == NULL) {
201+
LOG_ERROR("Shim: Cannot parse json: value does not exist");
202+
return -1;
203+
}
196204
std::string value = base64_decode(b64value);
197205
values.insert({key, value});
198206
}

0 commit comments

Comments
 (0)