diff options
Diffstat (limited to 'src/lib/libcrypto/dso/dso_dlfcn.c')
-rw-r--r-- | src/lib/libcrypto/dso/dso_dlfcn.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index 62b826ea43..9731df136d 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c | |||
@@ -255,23 +255,19 @@ dlfcn_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
255 | /* If the first file specification is a rooted path, it rules. | 255 | /* If the first file specification is a rooted path, it rules. |
256 | same goes if the second file specification is missing. */ | 256 | same goes if the second file specification is missing. */ |
257 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) { | 257 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) { |
258 | len = strlen(filespec1) + 1; | 258 | merged = strdup(filespec1); |
259 | merged = malloc(len); | ||
260 | if (!merged) { | 259 | if (!merged) { |
261 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 260 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); |
262 | return (NULL); | 261 | return (NULL); |
263 | } | 262 | } |
264 | strlcpy(merged, filespec1, len); | ||
265 | } | 263 | } |
266 | /* If the first file specification is missing, the second one rules. */ | 264 | /* If the first file specification is missing, the second one rules. */ |
267 | else if (!filespec1) { | 265 | else if (!filespec1) { |
268 | len = strlen(filespec2) + 1; | 266 | merged = strdup(filespec2); |
269 | merged = malloc(strlen(filespec2) + 1); | ||
270 | if (!merged) { | 267 | if (!merged) { |
271 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 268 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); |
272 | return (NULL); | 269 | return (NULL); |
273 | } | 270 | } |
274 | strlcpy(merged, filespec2, len); | ||
275 | } else | 271 | } else |
276 | /* This part isn't as trivial as it looks. It assumes that | 272 | /* This part isn't as trivial as it looks. It assumes that |
277 | the second file specification really is a directory, and | 273 | the second file specification really is a directory, and |