[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Tue Feb 28 14:21:40 UTC 2017


The branch master has been updated
       via  533b178db6aea206f07810ea20ecd43a90c51855 (commit)
      from  fa7e9ed3d16c7e713b67a84de9683837610cd318 (commit)


- Log -----------------------------------------------------------------
commit 533b178db6aea206f07810ea20ecd43a90c51855
Author: Pauli <paul.dale at oracle.com>
Date:   Mon Feb 27 14:26:16 2017 +1000

    Avoid buffer underflow in evp_test.
    
    The second loop in the remove_space function doesn't check for walking
    back off of the start of the string while setting white space to 0.
    
    This fix exits this loop once the pointer is before the (updated) beginning
    of the string.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2752)

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

Summary of changes:
 test/evp_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/evp_test.c b/test/evp_test.c
index 494a46b..d924e3f 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -23,17 +23,17 @@
 
 static void remove_space(char **pval)
 {
-    unsigned char *p = (unsigned char *)*pval;
+    unsigned char *p = (unsigned char *)*pval, *beginning;
 
     while (isspace(*p))
         p++;
 
-    *pval = (char *)p;
+    *pval = (char *)(beginning = p);
 
     p = p + strlen(*pval) - 1;
 
     /* Remove trailing space */
-    while (isspace(*p))
+    while (p >= beginning && isspace(*p))
         *p-- = 0;
 }
 


More information about the openssl-commits mailing list