summaryrefslogtreecommitdiff
path: root/ssh-pkcs11.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-06-26 09:36:10 +1000
committerDamien Miller <djm@mindrot.org>2010-06-26 09:36:10 +1000
commit4fe686d35fc1bbf5f160d1619ab392e09f3bd5c5 (patch)
tree9f073de6619c7692540348def963891ea9917454 /ssh-pkcs11.c
parent2e77446a13b0fd09c94c1a3d088b7d7e7e479fd3 (diff)
downloadopenssh-git-4fe686d35fc1bbf5f160d1619ab392e09f3bd5c5.tar.gz
- markus@cvs.openbsd.org 2010/06/08 21:32:19
[ssh-pkcs11.c] check length of value returned C_GetAttributValue for != 0 from mdrtbugzilla@codefive.co.uk; bugzilla #1773; ok dtucker@
Diffstat (limited to 'ssh-pkcs11.c')
-rw-r--r--ssh-pkcs11.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index 9460446d..286c232c 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11.c,v 1.5 2010/04/15 20:32:55 markus Exp $ */
+/* $OpenBSD: ssh-pkcs11.c,v 1.6 2010/06/08 21:32:19 markus Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
*
@@ -433,7 +433,13 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, Key ***keysp,
error("C_GetAttributeValue failed: %lu", rv);
continue;
}
- /* allocate buffers for attributes, XXX check ulValueLen? */
+ /* check that none of the attributes are zero length */
+ if (attribs[0].ulValueLen == 0 ||
+ attribs[1].ulValueLen == 0 ||
+ attribs[2].ulValueLen == 0) {
+ continue;
+ }
+ /* allocate buffers for attributes */
for (i = 0; i < 3; i++)
attribs[i].pValue = xmalloc(attribs[i].ulValueLen);
/* retrieve ID, modulus and public exponent of RSA key */