aboutsummaryrefslogtreecommitdiffstats
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
commita879a5f9c428e9c6d975c1e6874da0398a889df5 (patch)
treebaa3d83c344c53ef9a3b5913a44268426c248921 /dln.c
parent606363ed1d1a6eecd27e43c41cd5bddb32c98e96 (diff)
downloadruby-a879a5f9c428e9c6d975c1e6874da0398a889df5.tar.gz
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;
}