[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Fri Feb 26 16:27:15 UTC 2016


The branch master has been updated
       via  d3c02d844abeaf961bad692cf6f3876ccabf2435 (commit)
      from  acae59bb29ddc769743ab4a8ae373b5ff2f42b57 (commit)


- Log -----------------------------------------------------------------
commit d3c02d844abeaf961bad692cf6f3876ccabf2435
Author: Dmitry-Me <wipedout at yandex.ru>
Date:   Mon Feb 15 10:12:40 2016 +0300

    GH680: Reuse strnlen() in strndup()
    
    Signed-off-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>

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

Summary of changes:
 crypto/o_str.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/crypto/o_str.c b/crypto/o_str.c
index b200060..b01128c 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -133,17 +133,13 @@ char *CRYPTO_strdup(const char *str, const char* file, int line)
 
 char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
 {
-    const char *cp;
     size_t maxlen;
     char *ret;
 
     if (str == NULL)
         return NULL;
 
-    /* Get length. */
-    for (cp = str, maxlen = s; maxlen-- != 0 && *cp != '\0'; ++cp)
-        continue;
-    maxlen = cp - str;
+    maxlen = OPENSSL_strnlen(str, s)
 
     ret = CRYPTO_malloc(maxlen + 1, file, line);
     if (ret) {


More information about the openssl-commits mailing list