Fixed crash in public key access

Resolves: rhbz#1298669
This commit is contained in:
Nikos Mavrogiannopoulos 2016-01-18 13:32:13 +01:00
parent 3ef218b80a
commit 358a734ae9
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,31 @@
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

View File

@ -1,6 +1,6 @@
Name: opensc Name: opensc
Version: 0.15.0 Version: 0.15.0
Release: 3%{?dist} Release: 4%{?dist}
Summary: Smart card library and applications Summary: Smart card library and applications
Group: System Environment/Libraries Group: System Environment/Libraries
@ -22,6 +22,7 @@ Obsoletes: opensc-devel < 0.12.0
Patch0: opensc-0.15.0-fork-issue.patch Patch0: opensc-0.15.0-fork-issue.patch
Patch1: opensc-export-symbols.patch Patch1: opensc-export-symbols.patch
Patch2: opensc-0.15.0-pubkey-crash.patch
%description %description
OpenSC provides a set of libraries and utilities to work with smart cards. Its OpenSC provides a set of libraries and utilities to work with smart cards. Its
@ -139,6 +140,9 @@ rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d/
%changelog %changelog
* Thu Nov 19 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 0.15.0-4
- Fix a crash in accessing public key (#1298669)
* Thu Nov 19 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 0.15.0-3 * Thu Nov 19 2015 Nikos Mavrogiannopoulos <nmav@redhat.com> - 0.15.0-3
- Export PKCS#11 symbols from spy library (#1283306) - Export PKCS#11 symbols from spy library (#1283306)