File openssl-s_client-check-if-con-null-before-using-it.patch of Package compat-openssl098.31475
From d916ba1ba176adae488f148818eafc4e8c1a38ca Mon Sep 17 00:00:00 2001
From: Nils Larsch <nils@openssl.org>
Date: Sat, 18 Mar 2006 14:24:02 +0000
Subject: [PATCH] check if con != NULL before using it
---
apps/s_client.c | 8 ++++++--
apps/s_server.c | 11 +++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
Index: openssl-0.9.8a/apps/s_client.c
===================================================================
--- openssl-0.9.8a.orig/apps/s_client.c 2015-10-27 16:48:27.000000000 +0100
+++ openssl-0.9.8a/apps/s_client.c 2015-10-27 16:49:11.000000000 +0100
@@ -1081,8 +1081,12 @@
SHUTDOWN(SSL_get_fd(con));
ret=0;
end:
- if(prexit) print_stuff(bio_c_out,con,1);
- if (con != NULL) SSL_free(con);
+ if (con != NULL)
+ {
+ if (prexit != 0)
+ print_stuff(bio_c_out,con,1);
+ SSL_free(con);
+ }
if (con2 != NULL) SSL_free(con2);
if (ctx != NULL) SSL_CTX_free(ctx);
if (cert)
Index: openssl-0.9.8a/apps/s_server.c
===================================================================
--- openssl-0.9.8a.orig/apps/s_server.c 2015-10-27 16:48:12.000000000 +0100
+++ openssl-0.9.8a/apps/s_server.c 2015-10-27 16:48:27.000000000 +0100
@@ -1475,13 +1475,16 @@
}
}
err:
- BIO_printf(bio_s_out,"shutting down SSL\n");
+ if (con != NULL)
+ {
+ BIO_printf(bio_s_out,"shutting down SSL\n");
#if 1
- SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
+ SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
#else
- SSL_shutdown(con);
+ SSL_shutdown(con);
#endif
- if (con != NULL) SSL_free(con);
+ SSL_free(con);
+ }
BIO_printf(bio_s_out,"CONNECTION CLOSED\n");
if (buf != NULL)
{