diff options
author | Dmitry-Me <wipedout@yandex.ru> | 2016-02-03 17:34:14 +0300 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-03 15:45:56 -0500 |
commit | a89c9a0d855bce735116acfe147b24e386f566ba (patch) | |
tree | f5ababe4be7260111f36a82b2c9dbdd4c19a2e32 /crypto/dso | |
parent | 0f45c26f5ad232aa895187ce1d2b5b486d09677b (diff) | |
download | openssl-a89c9a0d855bce735116acfe147b24e386f566ba.tar.gz |
GH614: Use memcpy()/strdup() when possible
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'crypto/dso')
-rw-r--r-- | crypto/dso/dso_dl.c | 6 | ||||
-rw-r--r-- | crypto/dso/dso_dlfcn.c | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c index 977e177a4a..2b56e9eba9 100644 --- a/crypto/dso/dso_dl.c +++ b/crypto/dso/dso_dl.c @@ -236,23 +236,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 8d97cfb233..b6155b141b 100644 --- a/crypto/dso/dso_dlfcn.c +++ b/crypto/dso/dso_dlfcn.c @@ -280,23 +280,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 |