diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-06-29 18:52:22 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-06-29 19:05:16 +0200 |
commit | 338536364246d1e40b4d9f039c106d83594db724 (patch) | |
tree | bf79d675611ee0bd71e02adc08850701912549e7 | |
parent | 47f25d9e08d4e102572804a2aed186b01db23c65 (diff) | |
download | gnutls-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.c | 1 |
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; |