Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
opensc.35664
opensc-CVE-2024-45618.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File opensc-CVE-2024-45618.patch of Package opensc.35664
commit 8632ec172beda894581d67eaa991e519a7874f7d Author: Veronika HanulĂková <vhanulik@redhat.com> Date: Wed Jul 17 11:18:52 2024 +0200 pkcs15-tcos: Check return value of serial num conversion Thanks Matteo Marini for report https://github.com/OpenSC/OpenSC/security/advisories/GHSA-p3mx-7472-h3j8 fuzz_pkcs15_encode/21 Index: opensc-0.19.0/src/libopensc/pkcs15-tcos.c =================================================================== --- opensc-0.19.0.orig/src/libopensc/pkcs15-tcos.c +++ opensc-0.19.0/src/libopensc/pkcs15-tcos.c @@ -508,10 +508,15 @@ int sc_pkcs15emu_tcos_init_ex( /* get the card serial number */ r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serialnr); if (r < 0) { - sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "unable to get ICCSN\n"); + sc_log(ctx, "unable to get ICCSN"); return SC_ERROR_WRONG_CARD; } - sc_bin_to_hex(serialnr.value, serialnr.len , serial, sizeof(serial), 0); + r = sc_bin_to_hex(serialnr.value, serialnr.len, serial, sizeof(serial), 0); + if (r != SC_SUCCESS) { + sc_log(ctx, "serial number invalid"); + return SC_ERROR_INTERNAL; + } + serial[19] = '\0'; p15card->tokeninfo->serial_number = strdup(serial); Index: opensc-0.19.0/src/pkcs15init/pkcs15-lib.c =================================================================== --- opensc-0.19.0.orig/src/pkcs15init/pkcs15-lib.c +++ opensc-0.19.0/src/pkcs15init/pkcs15-lib.c @@ -3585,13 +3585,15 @@ sc_pkcs15init_get_transport_key(struct s if (callbacks.get_key) { rv = callbacks.get_key(profile, type, reference, defbuf, defsize, pinbuf, pinsize); LOG_TEST_RET(ctx, rv, "Cannot get key"); - } - else if (rv >= 0) { + } else if (rv >= 0) { if (*pinsize < defsize) LOG_TEST_RET(ctx, SC_ERROR_BUFFER_TOO_SMALL, "Get transport key error"); memcpy(pinbuf, data.key_data, data.len); *pinsize = data.len; + } else { + /* pinbuf and pinsize were not filled */ + LOG_TEST_RET(ctx, SC_ERROR_INTERNAL, "Get transport key error"); } memset(&auth_info, 0, sizeof(auth_info));
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor