From 91ccdc04fe2b9c9513d66e55bcdd49cab03e18cc Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 19 May 2017 13:06:29 +0200 Subject: [PATCH] Bug 1366187, pk11wrap: catch the case where NSSToken is not set, r=kaie --- lib/pk11wrap/pk11cert.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pk11wrap/pk11cert.c b/lib/pk11wrap/pk11cert.c index 804db6da98..c1caf5e60b 100644 --- a/lib/pk11wrap/pk11cert.c +++ b/lib/pk11wrap/pk11cert.c @@ -765,7 +765,12 @@ find_certs_from_nickname(const char *nickname, void *wincx) *delimit = ':'; } else { slot = PK11_GetInternalKeySlot(); - token = nssToken_AddRef(PK11Slot_GetNSSToken(slot)); + token = PK11Slot_GetNSSToken(slot); + if (token) { + nssToken_AddRef(token); + } else { + PORT_SetError(SEC_ERROR_NO_TOKEN); + } } if (token) { nssList *certList;