opensc/opensc-0.15.0-pubkey-crash.patch
Nikos Mavrogiannopoulos 358a734ae9 Fixed crash in public key access
Resolves: rhbz#1298669
2016-01-18 13:32:15 +01:00

32 lines
1.2 KiB
Diff

From 6e5ae841eb398b6393d7349d45f2386f820c9f5f Mon Sep 17 00:00:00 2001
From: LE TOUX Vincent <HG2025@sdmn01.sirius.infra.com>
Date: Sat, 2 Jan 2016 09:31:36 +0100
Subject: [PATCH] fix a pkcs11 crash when the public key reading fails
---
src/pkcs11/framework-pkcs15.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c
index e103550..8496f43 100644
--- a/src/pkcs11/framework-pkcs15.c
+++ b/src/pkcs11/framework-pkcs15.c
@@ -772,9 +772,11 @@ __pkcs15_prkey_bind_related(struct pkcs15_fw_data *fw_data, struct pkcs15_prkey_
if (sc_pkcs15_compare_id(&pubkey->pub_info->id, id)) {
sc_log(context, "Associating object %d as public key", i);
pk->prv_pubkey = pubkey;
- sc_pkcs15_dup_pubkey(context, pubkey->pub_data, &pk->pub_data);
- if (pk->prv_info->modulus_length == 0)
- pk->prv_info->modulus_length = pubkey->pub_info->modulus_length;
+ if (pubkey->pub_data) {
+ sc_pkcs15_dup_pubkey(context, pubkey->pub_data, &pk->pub_data);
+ if (pk->prv_info->modulus_length == 0)
+ pk->prv_info->modulus_length = pubkey->pub_info->modulus_length;
+ }
}
}
}
--
2.5.0