diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-03-11 22:35:53 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-03-11 22:35:53 +0100 |
commit | fa844f228c1a794dbf2a38634f6b7b3db6a535b7 (patch) | |
tree | 8e8d02ff887b842448e259764a32a9d85c365bf6 /lib/pkcs11.c | |
parent | c4bd38997c9c8799b99d0f9fc7496c5c51c903e1 (diff) | |
download | gnutls-fa844f228c1a794dbf2a38634f6b7b3db6a535b7.tar.gz |
pkcs11: only set ID and label when both size and data are set
Diffstat (limited to 'lib/pkcs11.c')
-rw-r--r-- | lib/pkcs11.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pkcs11.c b/lib/pkcs11.c index 936a56d1be..42d389c3a9 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -1435,7 +1435,7 @@ pkcs11_obj_import(ck_object_class_t class, gnutls_pkcs11_obj_t obj, return GNUTLS_E_MEMORY_ERROR; } - if (data && data->data) { + if (data && data->data && data->size) { ret = _gnutls_set_datum(&obj->raw, data->data, data->size); if (ret < 0) { gnutls_assert(); @@ -1449,7 +1449,7 @@ pkcs11_obj_import(ck_object_class_t class, gnutls_pkcs11_obj_t obj, memcpy(p11_kit_uri_get_module_info(obj->info), lib_info, sizeof(struct ck_info)); - if (label && label->data) { + if (label && label->data && label->size) { attr.type = CKA_LABEL; attr.value = label->data; attr.value_len = label->size; @@ -1460,7 +1460,7 @@ pkcs11_obj_import(ck_object_class_t class, gnutls_pkcs11_obj_t obj, } } - if (id && id->data) { + if (id && id->data && id->size) { attr.type = CKA_ID; attr.value = id->data; attr.value_len = id->size; |