Skip to content

Instantly share code, notes, and snippets.

View fishsoupisgood's full-sized avatar

fishsoupisgood

View GitHub Profile
@fishsoupisgood
fishsoupisgood / opensc-segv_fix.patch
Last active February 22, 2018 11:00
potential patch
diff --git a/src/libopensc/asn1.c b/src/libopensc/asn1.c
--- a/src/libopensc/asn1.c
+++ b/src/libopensc/asn1.c
@@ -477,6 +477,10 @@ const u8 *sc_asn1_find_tag(sc_context_t *ctx, const u8 * buf,
/* read a tag */
if (sc_asn1_read_tag(&p, left, &cla, &tag, &taglen) != SC_SUCCESS)
return NULL;
+
+ if (!p)
+ return NULL;
0x7ffa57dc7700 10:53:57.237 [opensc-pkcs11] ctx.c:823:sc_context_create: ===================================
0x7ffa57dc7700 10:53:57.237 [opensc-pkcs11] ctx.c:824:sc_context_create: opensc version: 0.17.0
0x7ffa57dc7700 10:53:57.237 [opensc-pkcs11] reader-pcsc.c:815:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=0 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
0x7ffa57dc7700 10:53:57.238 [opensc-pkcs11] reader-pcsc.c:1282:pcsc_detect_readers: called
0x7ffa57dc7700 10:53:57.238 [opensc-pkcs11] reader-pcsc.c:1301:pcsc_detect_readers: Probing PC/SC readers
0x7ffa57dc7700 10:53:57.238 [opensc-pkcs11] reader-pcsc.c:1329:pcsc_detect_readers: Establish PC/SC context
0x7ffa57dc7700 10:53:57.238 [opensc-pkcs11] reader-pcsc.c:1241:pcsc_add_reader: Adding new PC/SC reader 'Gemalto Ezio Shield (S145053776822) 00 00'
0x7ffa57dc7700 10:53:57.238 [opensc-pkcs11] reader-pcsc.c:319:refresh_attributes: Gemalto Ezio Shield (S145053776822) 00 00 check
0x7ffa57dc7700 10:53:57.238 [opens
--- opensc-0.17.1.orig/src/libopensc/apdu.c
+++ opensc-0.17.1/src/libopensc/apdu.c
@@ -424,7 +424,7 @@ sc_set_le_and_transmit(struct sc_card *c
static int
-sc_get_response(struct sc_card *card, struct sc_apdu *apdu, size_t olen)
+sc_get_response(struct sc_card *card, struct sc_apdu *apdu, size_t olen, int complete_reads)
{
struct sc_context *ctx = card->ctx;
0x7f1a6ef58700 15:34:39.502 [opensc-pkcs11] ctx.c:823:sc_context_create: ===================================
0x7f1a6ef58700 15:34:39.502 [opensc-pkcs11] ctx.c:824:sc_context_create: opensc version: 0.17.0
0x7f1a6ef58700 15:34:39.502 [opensc-pkcs11] reader-pcsc.c:815:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=0 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
0x7f1a6ef58700 15:34:39.502 [opensc-pkcs11] reader-pcsc.c:1282:pcsc_detect_readers: called
0x7f1a6ef58700 15:34:39.502 [opensc-pkcs11] reader-pcsc.c:1301:pcsc_detect_readers: Probing PC/SC readers
0x7f1a6ef58700 15:34:39.502 [opensc-pkcs11] reader-pcsc.c:1329:pcsc_detect_readers: Establish PC/SC context
0x7f1a6ef58700 15:34:39.503 [opensc-pkcs11] reader-pcsc.c:1241:pcsc_add_reader: Adding new PC/SC reader 'Gemalto Ezio Shield (S145053776822) 00 00'
0x7f1a6ef58700 15:34:39.503 [opensc-pkcs11] reader-pcsc.c:319:refresh_attributes: Gemalto Ezio Shield (S145053776822) 00 00 check
0x7f1a6ef58700 15:34:39.503 [opens
--- libglobalplatform6-6.0.0.orig/src/globalplatform.c
+++ libglobalplatform6-6.0.0/src/globalplatform.c
@@ -1304,10 +1304,36 @@ OPGP_ERROR_STATUS GP211_get_secure_chann
TLV tlv1, tlv2, _73tlv;
OPGP_LOG_START(_T("GP211_get_secure_channel_protocol_details"));
+#if 0
status = GP211_get_data(cardContext, cardInfo, NULL, (PBYTE)GP211_GET_DATA_CARD_DATA, recvBuffer, &recvBufferLength);
if (OPGP_ERROR_CHECK(status)) {
goto end;
--- libglobalplatform6-6.0.0.orig/src/globalplatform.c
+++ libglobalplatform6-6.0.0/src/globalplatform.c
@@ -1304,10 +1304,36 @@ OPGP_ERROR_STATUS GP211_get_secure_chann
TLV tlv1, tlv2, _73tlv;
OPGP_LOG_START(_T("GP211_get_secure_channel_protocol_details"));
+#if 0
status = GP211_get_data(cardContext, cardInfo, NULL, (PBYTE)GP211_GET_DATA_CARD_DATA, recvBuffer, &recvBufferLength);
if (OPGP_ERROR_CHECK(status)) {
goto end;