[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Mon Oct 16 09:15:07 UTC 2017


The branch master has been updated
       via  0bd42fde954a823cf6fffb6e13bd3dd4900a01e2 (commit)
       via  c7558d5be178b89648063fd8a001b7ab29616989 (commit)
      from  21c215423954e72ee0a8d6bcb813c45e166d4776 (commit)


- Log -----------------------------------------------------------------
commit 0bd42fde954a823cf6fffb6e13bd3dd4900a01e2
Author: Paul Yang <yang.yang at baishancloud.com>
Date:   Wed Oct 11 00:25:26 2017 +0800

    Fix a bug in ALPN comparation code of a test case
    
    Reviewed-by: Ben Kaduk <kaduk at mit.edu>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4497)

commit c7558d5be178b89648063fd8a001b7ab29616989
Author: Paul Yang <yang.yang at baishancloud.com>
Date:   Mon Oct 9 17:16:17 2017 +0800

    Fix reading heap overflow in a test case
    
    Caught by AddressSanitizer
    
    Reviewed-by: Ben Kaduk <kaduk at mit.edu>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4497)

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

Summary of changes:
 test/sslapitest.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/test/sslapitest.c b/test/sslapitest.c
index c1137b0..6267ce8 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -1974,19 +1974,20 @@ static int hostname_cb(SSL *s, int *al, void *arg)
 
 static const char *servalpn;
 
-static int alpn_select_cb (SSL *ssl, const unsigned char **out, unsigned char *outlen,
-                    const unsigned char *in, unsigned int inlen, void *arg)
+static int alpn_select_cb(SSL *ssl, const unsigned char **out,
+                          unsigned char *outlen, const unsigned char *in,
+                          unsigned int inlen, void *arg)
 {
-    unsigned int i, protlen = 0;
+    unsigned int protlen = 0;
     const unsigned char *prot;
 
-    for (i = 0, prot = in; i < inlen; i += protlen, prot += protlen) {
-        protlen = *(prot++);
-        if (inlen - i < protlen)
+    for (prot = in; prot < in + inlen; prot += protlen) {
+        protlen = *prot++;
+        if (in + inlen - prot < protlen)
             return SSL_TLSEXT_ERR_NOACK;
 
         if (protlen == strlen(servalpn)
-                && memcmp(prot, "goodalpn", protlen) == 0) {
+                && memcmp(prot, servalpn, protlen) == 0) {
             *out = prot;
             *outlen = protlen;
             return SSL_TLSEXT_ERR_OK;


More information about the openssl-commits mailing list