Albert Solana wrote:
...
Index: src/pkcs11/framework-pkcs15.c
===================================================================
--- src/pkcs11/framework-pkcs15.c       (revision 2941)
+++ src/pkcs11/framework-pkcs15.c       (working copy)
@@ -2478,7 +2478,14 @@
        size_t          len2;
len2 = len;
-       check_attribute_buffer(attr, len + 1 + sizeof(len));
+       size_t lenb = 1;
+        if (len > 127) {
+                unsigned int i = 0;
+                lenb++;         /* number of length bytes */
+                for (i = 0; (len & (0xff << i)) != 0 && (0xff << i) != 0; i++)
+                lenb++;
+        }
+        check_attribute_buffer(attr, 1 + lenb + len);
dest = (u8 *) attr->pValue;
        *dest++ = 0x30; /* SEQUENCE tag */

committed (with a minor modification as the above patch has a bug
(the first lenb++ line is IMHO wrong)).
Please test a recent snapshot.

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

Reply via email to