File opensc-oberthur-invalid-length.patch of Package opensc.31033

From cae5c71f90cc5b364efe14040923fd5aa3b5dd90 Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@redhat.com>
Date: Tue, 6 Apr 2021 12:45:24 +0200
Subject: [PATCH 5/5] oberthur: Handle 1B OIDs

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32807
---
 src/libopensc/pkcs15-oberthur.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: opensc-0.13.0/src/libopensc/pkcs15-oberthur.c
===================================================================
--- opensc-0.13.0.orig/src/libopensc/pkcs15-oberthur.c
+++ opensc-0.13.0/src/libopensc/pkcs15-oberthur.c
@@ -939,7 +939,7 @@ sc_pkcs15emu_oberthur_add_data(struct sc
 		free(info_blob);
 		LOG_TEST_RET(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Invalid length of 'oid' received");
 	}
-	if (oid_len)   {
+	if (oid_len > 2) {
 		oid = info_blob + offs + 2;
 		if (*oid != 0x06 || (*(oid + 1) != oid_len - 2))
 			SC_TEST_RET(ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Failed to add data: invalid 'OID' format");
openSUSE Build Service is sponsored by