From c6945481683cb7ef7d594d2976d9700e3b43a7d5 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 11 Mar 2019 16:05:49 +0100 Subject: [PATCH] Do not segfault when multiple pkcs11 providers is specified --- openssh-7.6p1-pkcs11-uri.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openssh-7.6p1-pkcs11-uri.patch b/openssh-7.6p1-pkcs11-uri.patch index 3343730..9dac289 100644 --- a/openssh-7.6p1-pkcs11-uri.patch +++ b/openssh-7.6p1-pkcs11-uri.patch @@ -3989,7 +3989,7 @@ diff -up openssh/ssh-pkcs11.c.pkcs11-uri openssh/ssh-pkcs11.c free(attribs[i].pValue); } if ((rv = f->C_FindObjectsFinal(session)) != CKR_OK) -@@ -592,126 +750,239 @@ pkcs11_fetch_keys_filter(struct pkcs11_p +@@ -592,126 +750,240 @@ pkcs11_fetch_keys_filter(struct pkcs11_p int pkcs11_add_provider(char *provider_id, char *pin, struct sshkey ***keyp) { @@ -4276,6 +4276,7 @@ diff -up openssh/ssh-pkcs11.c.pkcs11-uri openssh/ssh-pkcs11.c - free(p->slotlist); - free(p->slotinfo); - free(p); ++ TAILQ_REMOVE(&pkcs11_providers, p, next); + pkcs11_provider_unref(p); } - if (handle)