[openssl-commits] [openssl] master update

Paul I. Dale pauli at openssl.org
Tue Dec 18 08:26:10 UTC 2018


The branch master has been updated
       via  5aa2a7ea41d7137640cb0914807fd1202b920543 (commit)
      from  fc5ecaddd0c2aa76dfc8b9c4a7b3686cf2a3a292 (commit)


- Log -----------------------------------------------------------------
commit 5aa2a7ea41d7137640cb0914807fd1202b920543
Author: Quantomicus <quantumgleam at gmail.com>
Date:   Mon Dec 17 17:26:29 2018 +0100

    Fix s_client hang on non-compliant NNTP server test
    
    Fixes #7722
    
    CLA: trivial
    
    Signed-off-by: Mateja Milosevic <quantumgleam at gmail.com>
    
    Reviewed-by: Paul Yang <yang.yang at baishancloud.com>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/7915)

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

Summary of changes:
 apps/s_client.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/apps/s_client.c b/apps/s_client.c
index 8bdfbb6..51001d5 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -2535,12 +2535,16 @@ int s_client_main(int argc, char **argv)
             /* STARTTLS command requires CAPABILITIES... */
             BIO_printf(fbio, "CAPABILITIES\r\n");
             (void)BIO_flush(fbio);
-            /* wait for multi-line CAPABILITIES response */
-            do {
-                mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
-                if (strstr(mbuf, "STARTTLS"))
-                    foundit = 1;
-            } while (mbuf_len > 1 && mbuf[0] != '.');
+            BIO_gets(fbio, mbuf, BUFSIZZ);
+            /* no point in trying to parse the CAPABILITIES response if there is none */
+            if (strstr(mbuf, "101") != NULL) {
+                /* wait for multi-line CAPABILITIES response */
+                do {
+                    mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
+                    if (strstr(mbuf, "STARTTLS"))
+                        foundit = 1;
+                } while (mbuf_len > 1 && mbuf[0] != '.');
+            }
             (void)BIO_flush(fbio);
             BIO_pop(fbio);
             BIO_free(fbio);


More information about the openssl-commits mailing list