[pkg-opensc-maint] Bug#868299: pkcs15-init aborts with failed assertion when operating on Feitian smartcards

Sammy Atmadja sammy at transtrend.com
Fri Jul 14 10:16:03 UTC 2017

Package: opensc
Version: 0.16.0-3

When invoking pkcs15-init -E to erase a Feitian smartcard, the command aborts with the following message:

pkcs15-init: sc.c:721: sc_file_valid: Assertion `file != NULL' failed.

This bug has already been fixed upstream: 

Please consider backporting the fix (see patch below). I can confirm that applying the patch fixes the issue for me.

Index: opensc-0.16.0/src/libopensc/card-entersafe.c
--- opensc-0.16.0.orig/src/libopensc/card-entersafe.c
+++ opensc-0.16.0/src/libopensc/card-entersafe.c
@@ -493,7 +493,7 @@ static int entersafe_select_fid(sc_card_

        r = iso_ops->select_file(card,&path,&file);
-       if(r) sc_file_free(file);
+       if(r && file) sc_file_free(file);
        SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");

        /* update cache */


Disclaimer: http://transtrend.com/disclaimer.txt 

More information about the pkg-opensc-maint mailing list