Hello,

When forgetting the named PIN, that has reference which is not equal to -1,
the corresponding named_pin[] entry is not set to NULL.
It concerns the PINs for which both 'named_pin[]' and '*secret_cache'
have an entry.
(./opensc-0.11.1/src/pkcs15init/keycache.c +334)

In my case it results in segmentation fault.
(I use in loop the pkcs15init library for the smartcard initialisation.)

Here is the patch that solves this problem for me.

Kind wishes,
Viktor.


diff -NaurbB opensc-0.11.1.orig/src/pkcs15init/keycache.c
opensc-0.11.1/src/pkcs15init/keycache.c
--- opensc-0.11.1.orig/src/pkcs15init/keycache.c        2005-12-29
13:36:29.000000000 +0100
+++ opensc-0.11.1/src/pkcs15init/keycache.c     2006-10-27
16:13:03.000000000 +0200
@@ -331,7 +331,7 @@
       while ((s = *prev) != NULL) {
               if (__match_entry(s, type, ref, path, 1)) {
                       *prev = s->next;
-                       if (s->named_pin != -1 && s->ref == -1)
+                       if (s->named_pin >= 0 && s->named_pin <
SC_PKCS15INIT_NPINS)
                               named_pin[s->named_pin] = NULL;
                       sc_mem_clear(s, sizeof(*s));
                       free(s);


_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to