[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Richard Levitte levitte at openssl.org
Fri Feb 24 10:23:37 UTC 2017


The branch OpenSSL_1_0_2-stable has been updated
       via  847406923534dd791f73d0cda15d3f17f513f2a5 (commit)
      from  f65ee7126401eedeaaeea845bb1a258cd2fc6040 (commit)


- Log -----------------------------------------------------------------
commit 847406923534dd791f73d0cda15d3f17f513f2a5
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Sat Feb 11 08:53:24 2017 +0100

    Restore the test coverage of COMP_rle and SSL_COMP_add_compression_method
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2595)

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

Summary of changes:
 crypto/comp/c_rle.c | 25 +++++++++++++------------
 ssl/ssl_ciph.c      |  1 +
 test/Makefile       |  1 +
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/crypto/comp/c_rle.c b/crypto/comp/c_rle.c
index e9aabbd..4191961 100644
--- a/crypto/comp/c_rle.c
+++ b/crypto/comp/c_rle.c
@@ -31,12 +31,11 @@ static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
                               unsigned int olen, unsigned char *in,
                               unsigned int ilen)
 {
-    /* int i; */
+    if (ilen == 0)
+        return 0;
 
-    if (ilen == 0 || olen < (ilen - 1)) {
-        /* ZZZZZZZZZZZZZZZZZZZZZZ */
-        return (-1);
-    }
+    if (olen <= ilen)
+        return -1;
 
     *(out++) = 0;
     memcpy(out, in, ilen);
@@ -49,14 +48,16 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
 {
     int i;
 
-    if (olen < (ilen - 1)) {
-        /* ZZZZZZZZZZZZZZZZZZZZZZ */
-        return (-1);
-    }
+    if (ilen == 0)
+        return 0;
+
+    if (olen < (ilen - 1))
+        return -1;
 
     i = *(in++);
-    if (i == 0) {
-        memcpy(out, in, ilen - 1);
-    }
+    if (i != 0)
+        return -1;
+
+    memcpy(out, in, ilen - 1);
     return (ilen - 1);
 }
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
index 92b022b..4002132 100644
--- a/ssl/ssl_ciph.c
+++ b/ssl/ssl_ciph.c
@@ -2013,6 +2013,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
     }
     comp->id = id;
     comp->method = cm;
+    comp->name = cm->name;
     load_builtin_compressions();
     if (ssl_comp_methods && sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) {
         OPENSSL_free(comp);
diff --git a/test/Makefile b/test/Makefile
index 8f272ef..a324eeb 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -307,6 +307,7 @@ test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
 	fi
 	../util/shlib_wrap.sh ./$(SSLTEST) -test_cipherlist
 	@sh ./testssl keyU.ss certU.ss certCA.ss
+	@sh ./testssl keyU.ss certU.ss certCA.ss -rle
 	@sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
 	@sh ./testsslproxy keyP2.ss certP2.ss intP2.ss
 


More information about the openssl-commits mailing list