diff options
author | Darren Tucker <dtucker@zip.com.au> | 2006-05-04 16:24:34 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2006-05-04 16:24:34 +1000 |
commit | d8093e49bf06813a8c97cbc90810f4863388af77 (patch) | |
tree | 186c431180b5e63c14733c5d92a5cdb988426fca /scard-opensc.c | |
parent | 596d33801f6d703c1e45c74df6f6d6fe7ee085bb (diff) |
- (dtucker) [auth-pam.c groupaccess.c monitor.c monitor_wrap.c scard-opensc.c
session.c ssh-rand-helper.c sshd.c openbsd-compat/bsd-cygwin_util.c
openbsd-compat/setproctitle.c] Convert malloc(foo*bar) -> calloc(foo,bar)
in Portable-only code; since calloc zeros, remove now-redundant memsets.
Also add a couple of sanity checks. With & ok djm@
Diffstat (limited to 'scard-opensc.c')
-rw-r--r-- | scard-opensc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scard-opensc.c b/scard-opensc.c index dd2c28df2..7a496dff8 100644 --- a/scard-opensc.c +++ b/scard-opensc.c | |||
@@ -455,7 +455,9 @@ sc_get_keys(const char *id, const char *pin) | |||
455 | } | 455 | } |
456 | key_count = r; | 456 | key_count = r; |
457 | } | 457 | } |
458 | keys = xmalloc(sizeof(Key *) * (key_count*2+1)); | 458 | if (key_count > 1024) |
459 | fatal("Too many keys (%u), expected <= 1024", key_count); | ||
460 | keys = xcalloc(key_count * 2 + 1, sizeof(Key *)); | ||
459 | for (i = 0; i < key_count; i++) { | 461 | for (i = 0; i < key_count; i++) { |
460 | sc_pkcs15_object_t *tmp_obj = NULL; | 462 | sc_pkcs15_object_t *tmp_obj = NULL; |
461 | cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id; | 463 | cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id; |