]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
fix segfault when reading certificate from smartcard
authorEgbert Koening <e.kunig@home.nl>
Fri, 15 Oct 2010 09:09:24 +0000 (11:09 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 15 Oct 2010 09:09:38 +0000 (11:09 +0200)
src/pluto/connections.c

index 2a3421961161e1b7b87f1d0fa57e8634efaf670d..9f277e135ffb445800984f93d5aaf792b456503b 100644 (file)
@@ -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);