pkcs11-spy: Fix attribute displaying crash in case pTemplate=NULL

In real world pTemplate=NULL case is only used by PKCS#11 test suites but
no need to crash them.

Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
This commit is contained in:
Vesa Jääskeläinen 2021-08-04 16:53:22 +03:00 committed by Jakub Jelen
parent cababca4d5
commit e97fec4d91
1 changed files with 6 additions and 0 deletions

View File

@ -1036,6 +1036,9 @@ print_attribute_list(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
CK_ULONG j, k;
int found;
if (!pTemplate)
return;
for(j = 0; j < ulCount ; j++) {
found = 0;
for(k = 0; k < ck_attribute_num; k++) {
@ -1067,6 +1070,9 @@ print_attribute_list_req(FILE *f, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
CK_ULONG j, k;
int found;
if (!pTemplate)
return;
for(j = 0; j < ulCount ; j++) {
found = 0;
for(k = 0; k < ck_attribute_num; k++) {