summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-29 18:52:22 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-29 19:05:16 +0200
commit338536364246d1e40b4d9f039c106d83594db724 (patch)
treebf79d675611ee0bd71e02adc08850701912549e7
parent47f25d9e08d4e102572804a2aed186b01db23c65 (diff)
downloadgnutls-338536364246d1e40b4d9f039c106d83594db724.tar.gz
pkcs11_get_attribute_avalue: do not assign values on failure
When C_GetAttributeValue() returns size but does not return data then pkcs11_get_attribute_avalue() would set the return data pointer to a free'd value. This is against the convention expected by callers, i.e, set data to NULL. Reported by Anthony Alba in #108.
-rw-r--r--lib/pkcs11_int.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/pkcs11_int.c b/lib/pkcs11_int.c
index 2ae35e372d..25c537bbed 100644
--- a/lib/pkcs11_int.c
+++ b/lib/pkcs11_int.c
@@ -148,6 +148,7 @@ pkcs11_get_attribute_avalue(struct ck_function_list * module,
rv = (module)->C_GetAttributeValue(sess, object, &templ, 1);
if (rv != CKR_OK) {
gnutls_free(t);
+ return rv;
}
res->data = t;
res->size = templ.value_len;