From 5dc51d821ef76c610d64464d511c34bf6b67e74a Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 30 Mar 2015 05:27:21 +0000 Subject: file.c: include terminator * win32/file.c (rb_readlink): include the terminator, since rb_w32_mbstr_to_wstr appends a terminator only when the length is not given explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win32/file.c b/win32/file.c index 0f5b285ff8..6452aadaba 100644 --- a/win32/file.c +++ b/win32/file.c @@ -671,7 +671,8 @@ rb_readlink(VALUE path) path = fix_string_encoding(path, enc); cp = CP_UTF8; } - wpath = mbstr_to_wstr(cp, RSTRING_PTR(path), RSTRING_LEN(path), NULL); + wpath = mbstr_to_wstr(cp, RSTRING_PTR(path), + RSTRING_LEN(path)+rb_enc_mbminlen(enc), NULL); if (!wpath) rb_memerror(); len = rb_w32_wreadlink(wpath, wbuf, numberof(wbuf)); free(wpath); -- cgit v1.2.3