]> andersk Git - openssh.git/blobdiff - scard-opensc.c
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / scard-opensc.c
index dd2c28df250c13cd4b5f9a8c145341d010ef9f2e..36dae05fd5a8c908b59fd02a7c5ab7fff451b22e 100644 (file)
 #include "includes.h"
 #if defined(SMARTCARD) && defined(USE_OPENSC)
 
+#include <sys/types.h>
+
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 
+#include <stdarg.h>
+#include <string.h>
+
 #include <opensc/opensc.h>
 #include <opensc/pkcs15.h>
 
@@ -455,7 +460,9 @@ sc_get_keys(const char *id, const char *pin)
                }
                key_count = r;
        }
-       keys = xmalloc(sizeof(Key *) * (key_count*2+1));
+       if (key_count > 1024)
+               fatal("Too many keys (%u), expected <= 1024", key_count);
+       keys = xcalloc(key_count * 2 + 1, sizeof(Key *));
        for (i = 0; i < key_count; i++) {
                sc_pkcs15_object_t *tmp_obj = NULL;
                cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id;
This page took 0.031041 seconds and 4 git commands to generate.