Commit 108635a3 authored by Robert Edmonds's avatar Robert Edmonds

protobuf-c: parse_required_member(): zero bd->data in 0-length byte string case

in the case that we are unpacking a 0-length byte string, we need to
explicitly set bd->data to NULL, otherwise we may try to free() a stray
pointer when protobuf_c_message_free_unpacked() is called on the
containing message.

(Issue #157.)
parent 4c2225d0
......@@ -2304,6 +2304,8 @@ parse_required_member(ScannedMember *scanned_member,
if (bd->data == NULL)
return FALSE;
memcpy(bd->data, data + pref_len, len - pref_len);
} else {
bd->data = NULL;
}
bd->len = len - pref_len;
return TRUE;
......
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