[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Thu Sep 14 20:49:09 UTC 2017


The branch master has been updated
       via  297002a332302a102a9fd802012f12ba2ad056c1 (commit)
       via  6807b84eacc89aee6eed2730e7dd3ce7171cc834 (commit)
      from  f5d270cab5021047cd88b71b92243141912f3906 (commit)


- Log -----------------------------------------------------------------
commit 297002a332302a102a9fd802012f12ba2ad056c1
Author: Rich Salz <rsalz at openssl.org>
Date:   Thu Sep 14 16:13:53 2017 -0400

    Replace malloc+strcpy with strdup
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4371)

commit 6807b84eacc89aee6eed2730e7dd3ce7171cc834
Author: Rich Salz <rsalz at openssl.org>
Date:   Thu Sep 14 16:13:00 2017 -0400

    Fix function name in ECerr call
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4371)

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

Summary of changes:
 crypto/dso/dso_dl.c     | 6 ++----
 crypto/dso/dso_dlfcn.c  | 6 ++----
 crypto/dso/dso_win32.c  | 6 ++----
 crypto/ec/ec_ameth.c    | 2 +-
 crypto/ec/ec_err.c      | 1 +
 crypto/err/openssl.txt  | 1 +
 include/openssl/ecerr.h | 1 +
 7 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c
index af968e3..d80bf56 100644
--- a/crypto/dso/dso_dl.c
+++ b/crypto/dso/dso_dl.c
@@ -156,23 +156,21 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2)
      * if the second file specification is missing.
      */
     if (!filespec2 || filespec1[0] == '/') {
-        merged = OPENSSL_malloc(strlen(filespec1) + 1);
+        merged = OPENSSL_strdup(filespec1);
         if (merged == NULL) {
             DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        strcpy(merged, filespec1);
     }
     /*
      * If the first file specification is missing, the second one rules.
      */
     else if (!filespec1) {
-        merged = OPENSSL_malloc(strlen(filespec2) + 1);
+        merged = OPENSSL_strdup(filespec2);
         if (merged == NULL) {
             DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        strcpy(merged, filespec2);
     } else
         /*
          * This part isn't as trivial as it looks.  It assumes that the
diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c
index e2aa76e..a4b0cdd 100644
--- a/crypto/dso/dso_dlfcn.c
+++ b/crypto/dso/dso_dlfcn.c
@@ -196,23 +196,21 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
      * if the second file specification is missing.
      */
     if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) {
-        merged = OPENSSL_malloc(strlen(filespec1) + 1);
+        merged = OPENSSL_strdup(filespec1);
         if (merged == NULL) {
             DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        strcpy(merged, filespec1);
     }
     /*
      * If the first file specification is missing, the second one rules.
      */
     else if (!filespec1) {
-        merged = OPENSSL_malloc(strlen(filespec2) + 1);
+        merged = OPENSSL_strdup(filespec2);
         if (merged == NULL) {
             DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        strcpy(merged, filespec2);
     } else {
         /*
          * This part isn't as trivial as it looks.  It assumes that the
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index 635974b..5f50774 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -398,19 +398,17 @@ static char *win32_merger(DSO *dso, const char *filespec1,
         return (NULL);
     }
     if (!filespec2) {
-        merged = OPENSSL_malloc(strlen(filespec1) + 1);
+        merged = OPENSSL_strdup(filespec1);
         if (merged == NULL) {
             DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        strcpy(merged, filespec1);
     } else if (!filespec1) {
-        merged = OPENSSL_malloc(strlen(filespec2) + 1);
+        merged = OPENSSL_strdup(filespec2);
         if (merged == NULL) {
             DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE);
             return (NULL);
         }
-        strcpy(merged, filespec2);
     } else {
         filespec1_split = win32_splitter(dso, filespec1, 0);
         if (!filespec1_split) {
diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index ecf1a02..22ad6b0 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -526,7 +526,7 @@ static int ec_pkey_check(const EVP_PKEY *pkey)
 
     /* stay consistent to what EVP_PKEY_check demands */
     if (eckey->priv_key == NULL) {
-        ECerr(EC_F_EC_KEY_CHECK_KEY, EC_R_MISSING_PRIVATE_KEY);
+        ECerr(EC_F_EC_PKEY_CHECK, EC_R_MISSING_PRIVATE_KEY);
         return 0;
     }
 
diff --git a/crypto/ec/ec_err.c b/crypto/ec/ec_err.c
index 0097825..19a7a9d 100644
--- a/crypto/ec/ec_err.c
+++ b/crypto/ec/ec_err.c
@@ -181,6 +181,7 @@ static const ERR_STRING_DATA EC_str_functs[] = {
      "ec_key_simple_oct2priv"},
     {ERR_PACK(ERR_LIB_EC, EC_F_EC_KEY_SIMPLE_PRIV2OCT, 0),
      "ec_key_simple_priv2oct"},
+    {ERR_PACK(ERR_LIB_EC, EC_F_EC_PKEY_CHECK, 0), "ec_pkey_check"},
     {ERR_PACK(ERR_LIB_EC, EC_F_EC_POINTS_MAKE_AFFINE, 0),
      "EC_POINTs_make_affine"},
     {ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_ADD, 0), "EC_POINT_add"},
diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt
index b05d459..11a1365 100644
--- a/crypto/err/openssl.txt
+++ b/crypto/err/openssl.txt
@@ -539,6 +539,7 @@ EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES:229:\
 EC_F_EC_KEY_SIMPLE_CHECK_KEY:258:ec_key_simple_check_key
 EC_F_EC_KEY_SIMPLE_OCT2PRIV:259:ec_key_simple_oct2priv
 EC_F_EC_KEY_SIMPLE_PRIV2OCT:260:ec_key_simple_priv2oct
+EC_F_EC_PKEY_CHECK:273:ec_pkey_check
 EC_F_EC_POINTS_MAKE_AFFINE:136:EC_POINTs_make_affine
 EC_F_EC_POINT_ADD:112:EC_POINT_add
 EC_F_EC_POINT_CMP:113:EC_POINT_cmp
diff --git a/include/openssl/ecerr.h b/include/openssl/ecerr.h
index 55caec4..b04599a 100644
--- a/include/openssl/ecerr.h
+++ b/include/openssl/ecerr.h
@@ -125,6 +125,7 @@ int ERR_load_EC_strings(void);
 # define EC_F_EC_KEY_SIMPLE_CHECK_KEY                     258
 # define EC_F_EC_KEY_SIMPLE_OCT2PRIV                      259
 # define EC_F_EC_KEY_SIMPLE_PRIV2OCT                      260
+# define EC_F_EC_PKEY_CHECK                               273
 # define EC_F_EC_POINTS_MAKE_AFFINE                       136
 # define EC_F_EC_POINT_ADD                                112
 # define EC_F_EC_POINT_CMP                                113


More information about the openssl-commits mailing list