coolkey: Make sure the object ID is unique when filling list

Thanks to oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19208
This commit is contained in:
Jakub Jelen 2019-12-04 15:54:43 +01:00 committed by Frank Morgner
parent 32b49894c5
commit c246f6f69a
1 changed files with 5 additions and 0 deletions

View File

@ -1945,6 +1945,11 @@ coolkey_add_object(coolkey_private_data_t *priv, unsigned long object_id, const
new_object.id = object_id;
new_object.length = object_length;
/* The object ID needs to be unique */
if (coolkey_find_object_by_id(&priv->objects_list, object_id) != NULL) {
return SC_ERROR_INTERNAL;
}
if (object_data) {
new_object.data = malloc(object_length + add_v1_record);
if (new_object.data == NULL) {