summaryrefslogtreecommitdiffstats
path: root/crypto/dso
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-09-12 09:13:00 +1000
committerPauli <paul.dale@oracle.com>2017-09-14 10:26:54 +1000
commit4cacc9d510c20368d13dcaf2c95c25d6d1ceef6c (patch)
tree9002903f4a5d89582cac7602d41df7903c7e277d /crypto/dso
parenteff1752b66cb7bf6ca8af816eb10ead26910d025 (diff)
Revert "GH614: Use memcpy()/strdup() when possible"
This reverts commit a89c9a0d855bce735116acfe147b24e386f566ba. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4357)
Diffstat (limited to 'crypto/dso')
-rw-r--r--crypto/dso/dso_dl.c6
-rw-r--r--crypto/dso/dso_dlfcn.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c
index d80bf562c7..af968e3ead 100644
--- a/crypto/dso/dso_dl.c
+++ b/crypto/dso/dso_dl.c
@@ -156,21 +156,23 @@ 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_strdup(filespec1);
+ merged = OPENSSL_malloc(strlen(filespec1) + 1);
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_strdup(filespec2);
+ merged = OPENSSL_malloc(strlen(filespec2) + 1);
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 a4b0cdd95b..e2aa76eb65 100644
--- a/crypto/dso/dso_dlfcn.c
+++ b/crypto/dso/dso_dlfcn.c
@@ -196,21 +196,23 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
* if the second file specification is missing.
*/
if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) {
- merged = OPENSSL_strdup(filespec1);
+ merged = OPENSSL_malloc(strlen(filespec1) + 1);
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_strdup(filespec2);
+ merged = OPENSSL_malloc(strlen(filespec2) + 1);
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