summaryrefslogtreecommitdiff
path: root/dln.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-26 09:28:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-26 09:28:46 +0000
commit79c50a77ff210baa369e5c0babc44b1a0da23fbe (patch)
treebaa3d83c344c53ef9a3b5913a44268426c248921 /dln.c
parentd0035dbdf83a48bd96fc1e0646b4ae01d3a2f135 (diff)
get rid of strcpy
* addr2line.c (follow_debuglink): insert global_debug_dir by using memmove instead of copying to temporary buffer. * dln.c (dln_load): use memcpy with the known length instead of strcpy. * gc.c (rb_gc_unprotect_logging): use strdup instead of malloc and strcpy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dln.c b/dln.c
index f52fc9f021..55f29fda51 100644
--- a/dln.c
+++ b/dln.c
@@ -1250,7 +1250,6 @@ dln_load(const char *file)
#endif
#if !defined(_AIX) && !defined(NeXT)
const char *error = 0;
-#define DLN_ERROR() (error = dln_strerror(), strcpy(ALLOCA_N(char, strlen(error) + 1), error))
#endif
#if defined _WIN32
@@ -1349,7 +1348,8 @@ dln_load(const char *file)
init_fct = (void(*)())(VALUE)dlsym(handle, buf);
if (init_fct == NULL) {
- error = DLN_ERROR();
+ const size_t errlen = strlen(error = dln_strerror()) + 1;
+ error = memcpy(ALLOCA_N(char, errlen), error, errlen);
dlclose(handle);
goto failed;
}