diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-06-29 18:52:22 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-06-29 18:57:14 +0200 |
commit | 838be9217ce5a267b86221d536867816101d53e1 (patch) | |
tree | 32dff0a1c47b5c3c4b4ac66e81a8e59acb14076a | |
parent | cc22a052f40ba800acde7d81fe0ab91b56e66921 (diff) | |
download | gnutls-838be9217ce5a267b86221d536867816101d53e1.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 c66a08cece..944ee678b2 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; |