Commit 07e92dd1 authored by Nikias Bassen's avatar Nikias Bassen

bplist: Make sure to bail out if malloc() fails in parse_unicode_node()

Credit to OSS-Fuzz
parent 56ba9bf7
......@@ -368,6 +368,11 @@ static plist_t parse_unicode_node(const char **bnode, uint64_t size)
data->type = PLIST_STRING;
unicodestr = (uint16_t*) malloc(sizeof(uint16_t) * size);
if (!unicodestr) {
plist_free_data(data);
PLIST_BIN_ERR("%s: Could not allocate %" PRIu64 " bytes\n", __func__, sizeof(uint16_t) * size);
return NULL;
}
for (i = 0; i < size; i++)
unicodestr[i] = be16toh(((uint16_t*)*bnode)[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment