File opensc-0_19_0-CVE-2019-20792.patch of Package opensc.26104

Index: opensc-0.19.0/src/libopensc/card-coolkey.c
===================================================================
--- opensc-0.19.0.orig/src/libopensc/card-coolkey.c
+++ opensc-0.19.0/src/libopensc/card-coolkey.c
@@ -1956,6 +1956,11 @@ coolkey_add_object(coolkey_private_data_
 	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) {
openSUSE Build Service is sponsored by