From 4de8398f931e1777c685710c87ad412bcf6715c4 Mon Sep 17 00:00:00 2001 From: Egbert Koening Date: Fri, 15 Oct 2010 11:09:24 +0200 Subject: [PATCH] fix segfault when reading certificate from smartcard --- src/pluto/connections.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pluto/connections.c b/src/pluto/connections.c index 2a3421961..9f277e135 100644 --- a/src/pluto/connections.c +++ b/src/pluto/connections.c @@ -874,7 +874,8 @@ static void load_end_certificate(char *filename, struct end *dst) /* cache the certificate that was last retrieved from the smartcard */ if (dst->sc) { - if (!certificate->equals(certificate, dst->sc->last_cert->cert)) + if (!dst->sc->last_cert || + !certificate->equals(certificate, dst->sc->last_cert->cert)) { lock_certs_and_keys("load_end_certificates"); cert_release(dst->sc->last_cert);