[openssl-commits] [openssl] master update

Andy Polyakov appro at openssl.org
Sun Oct 22 19:32:59 UTC 2017


The branch master has been updated
       via  f84a648ca1da0177e7ed1d4b50312c5dd6a2c0c8 (commit)
      from  0c1aaa24cc30de8d793f965f4a01863a25773a50 (commit)


- Log -----------------------------------------------------------------
commit f84a648ca1da0177e7ed1d4b50312c5dd6a2c0c8
Author: KaoruToda <kunnpuu at gmail.com>
Date:   Thu Oct 19 23:41:03 2017 +0900

    apps/s_client.c: add missing null check
    apps/s_server.c: remove unnecessary null check
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4558)

-----------------------------------------------------------------------

Summary of changes:
 apps/s_client.c |  3 +++
 apps/s_server.c | 27 +++++++++++++++------------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/apps/s_client.c b/apps/s_client.c
index 96bfc15..019e735 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -1866,6 +1866,9 @@ int s_client_main(int argc, char **argv)
         goto end;
 
     con = SSL_new(ctx);
+    if (con == NULL)
+        goto end;
+
     if (sess_in != NULL) {
         SSL_SESSION *sess;
         BIO *stmp = BIO_new_file(sess_in, "r");
diff --git a/apps/s_server.c b/apps/s_server.c
index a7d85f3..311f4a2 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -2202,22 +2202,25 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
             BIO_printf(bio_err, "Turned on non blocking io\n");
     }
 
+    con = SSL_new(ctx);
     if (con == NULL) {
-        con = SSL_new(ctx);
+        ret = -1;
+        goto err;
+    }
 
-        if (s_tlsextdebug) {
-            SSL_set_tlsext_debug_callback(con, tlsext_cb);
-            SSL_set_tlsext_debug_arg(con, bio_s_out);
-        }
+    if (s_tlsextdebug) {
+        SSL_set_tlsext_debug_callback(con, tlsext_cb);
+        SSL_set_tlsext_debug_arg(con, bio_s_out);
+    }
 
-        if (context
-            && !SSL_set_session_id_context(con,
-                                           context, strlen((char *)context))) {
-            BIO_printf(bio_err, "Error setting session id context\n");
-            ret = -1;
-            goto err;
-        }
+    if (context != NULL
+        && !SSL_set_session_id_context(con, context,
+                                       strlen((char *)context))) {
+        BIO_printf(bio_err, "Error setting session id context\n");
+        ret = -1;
+        goto err;
     }
+
     if (!SSL_clear(con)) {
         BIO_printf(bio_err, "Error clearing SSL connection\n");
         ret = -1;


More information about the openssl-commits mailing list