Hi, 

I'm new to this list and just trying to get ACOS 5 cards working. From 
earlier posts I found that there have been attempts to get this card 
working but it looks like nobody realy succeeded. 

What I've here are some cards which are already initialized with something 
like a PKCS#15 file structure. So for now I will not do any work on 
initalizing the blank card. But if anybody already made some success in 
getting this file structure recognized by opensc any help is greatly 
appreciated. 

Anyway, while trying to get familiar with the opensc framework I came 
accross a memory leak in the basic ACOS 5 card driver already present. 
Patch to fix this is attached. Hope the patch format is ok. If not, please 
advice. 

Best regards, 

Peter 
Index: src/libopensc/card-acos5.c

===================================================================

--- src/libopensc/card-acos5.c  (revision 4350)

+++ src/libopensc/card-acos5.c  (working copy)

@@ -77,16 +77,17 @@

        /*
         * File ID by file ID...
         */
-       while (in_len) {
+       while (in_len > 2) {
                int result;
                memcpy(path.value, in_pos, 2);
-               result = iso_ops->select_file(card, &path, file_out);
+               result = iso_ops->select_file(card, &path, NULL);
                if (result != SC_SUCCESS)
                        return result;
                in_len -= 2;
                in_pos += 2;
        }
-       return SC_SUCCESS;
+       memcpy(path.value, in_pos, 2);
+       return iso_ops->select_file(card, &path, file_out);
 }
 
 static int acos5_select_file(sc_card_t * card,
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to