From e97fec4d91b1abd7bcf609070f16002ed91bce69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20J=C3=A4=C3=A4skel=C3=A4inen?= Date: Wed, 4 Aug 2021 16:53:22 +0300 Subject: [PATCH] pkcs11-spy: Fix attribute displaying crash in case pTemplate=NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/pkcs11/pkcs11-display.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pkcs11/pkcs11-display.c b/src/pkcs11/pkcs11-display.c index 0117228d..9fa24a6c 100644 --- a/src/pkcs11/pkcs11-display.c +++ b/src/pkcs11/pkcs11-display.c @@ -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++) {