From 64989fa5a2a8022aee8e6a5b71eb1e77eba5ce82 Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 30 Sep 2012 12:20:09 +0000 Subject: * string.c (rb_str_concat): use memcpy to copy a string which contains NUL characters. [ruby-core:47751] [Bug #7090] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 26463b95e2..71a06abacc 100644 --- a/string.c +++ b/string.c @@ -2158,7 +2158,7 @@ rb_str_concat(VALUE str1, VALUE str2) rb_raise(rb_eRangeError, "invalid codepoint 0x%X in %s", code, rb_enc_name(enc)); } rb_str_resize(str1, pos+len); - strncpy(RSTRING_PTR(str1) + pos, buf, len); + memcpy(RSTRING_PTR(str1) + pos, buf, len); if (cr == ENC_CODERANGE_7BIT && code > 127) cr = ENC_CODERANGE_VALID; ENC_CODERANGE_SET(str1, cr); -- cgit v1.2.3