Fix double free bug in SSL code

* src/openssl.c, src/gnutls.c (ssl_init): Copy options using xstrdup
This commit is contained in:
Rohit Mathulla 2015-04-24 15:48:29 +10:00 committed by Tim Ruehsen
parent 566696cb82
commit 8654f7e2e7
2 changed files with 3 additions and 3 deletions

View File

@ -184,13 +184,13 @@ ssl_init (void)
/* Use the private key from the cert file unless otherwise specified. */
if (opt.cert_file && !opt.private_key)
{
opt.private_key = opt.cert_file;
opt.private_key = xstrdup (opt.cert_file);
opt.private_key_type = opt.cert_type;
}
/* Use the cert from the private key file unless otherwise specified. */
if (!opt.cert_file && opt.private_key)
{
opt.cert_file = opt.private_key;
opt.cert_file = xstrdup (opt.private_key);
opt.cert_type = opt.private_key_type;
}

View File

@ -292,7 +292,7 @@ ssl_init (void)
/* Use the private key from the cert file unless otherwise specified. */
if (opt.cert_file && !opt.private_key)
{
opt.private_key = opt.cert_file;
opt.private_key = xstrdup (opt.cert_file);
opt.private_key_type = opt.cert_type;
}