Hello everybody, in the PKCS11 standard it is defined that C_GetAttributeValue may return a length of -1 with some non-CKR_OK return codes. The PKCS11 spy checks that: if (rv == CKR_OK || rv == CKR_ATTRIBUTE_SENSITIVE || rv == CKR_ATTRIBUTE_TYPE_INVALID || rv == CKR_BUFFER_TOO_SMALL) { spy_attribute_list_out("pTemplate", pTemplate, ulCount)
But then the check in pkcs11-display.c is wrong; the size is an unsigned long, and so the check "size>0" only matches for 0. http://www.opensc-project.org/svn/opensc/trunk/src/pkcs11/pkcs11-display.c A possible solution could be something like diff -u pkcs11-display.c.orig pkcs11-display.c --- pkcs11-display.c.orig 2007-02-02 23:15:14.000000000 +0100 +++ pkcs11-display.c 2007-06-21 09:12:41.000000000 +0200 @@ -108,7 +108,7 @@ void print_generic(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR arg) { CK_ULONG i; - if(size > 0 && value != NULL) { + if(size > 0 && value != NULL && size != (CK_ULONG)-1) { fprintf(f, "[size : 0x%lX (%ld)]\n ", size, size); for(i = 0; i < size; i++) { if (i != 0) { I took a look at the other print_* functions, but they don't seem to have this problem - or do they? Regards, Phil _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel