Commit 386ed2d5 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

gtls: fix NULL pointer dereference

gnutls_x509_crt_import() must not be called with a NULL certificate

Bug: http://curl.haxx.se/mail/lib-2014-04/0145.html
Reported-by: Damian Dixon
parent 5b463e97
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -735,6 +735,7 @@ gtls_connect_step3(struct connectdata *conn,
  /* initialize an X.509 certificate structure. */
  gnutls_x509_crt_init(&x509_cert);

  if(chainp)
    /* convert the given DER or PEM encoded Certificate to the native
       gnutls_x509_crt_t format */
    gnutls_x509_crt_import(x509_cert, chainp, GNUTLS_X509_FMT_DER);