[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Mon Feb 29 22:34:16 UTC 2016


The branch master has been updated
       via  edae9834b6eeeb7af8839187a6de82131991ec4b (commit)
      from  1c03c81f52c15eb4f4b8aac158313c31be82e3e5 (commit)


- Log -----------------------------------------------------------------
commit edae9834b6eeeb7af8839187a6de82131991ec4b
Author: Dmitry-Me <wipedout at yandex.ru>
Date:   Mon Feb 29 11:55:13 2016 +0300

    GH762: Reuse strdup()
    
    Signed-off-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>

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

Summary of changes:
 crypto/dso/dso_lib.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index 0921fb2..c410eac 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -341,12 +341,11 @@ int DSO_set_filename(DSO *dso, const char *filename)
         return (0);
     }
     /* We'll duplicate filename */
-    copied = OPENSSL_malloc(strlen(filename) + 1);
+    copied = OPENSSL_strdup(filename);
     if (copied == NULL) {
         DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);
         return (0);
     }
-    OPENSSL_strlcpy(copied, filename, strlen(filename) + 1);
     OPENSSL_free(dso->filename);
     dso->filename = copied;
     return (1);
@@ -390,12 +389,11 @@ char *DSO_convert_filename(DSO *dso, const char *filename)
             result = dso->meth->dso_name_converter(dso, filename);
     }
     if (result == NULL) {
-        result = OPENSSL_malloc(strlen(filename) + 1);
+        result = OPENSSL_strdup(filename);
         if (result == NULL) {
             DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        OPENSSL_strlcpy(result, filename, strlen(filename) + 1);
     }
     return (result);
 }


More information about the openssl-commits mailing list