summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-30 05:27:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-30 05:27:21 +0000
commit5dc51d821ef76c610d64464d511c34bf6b67e74a (patch)
tree838ddbd6dec77372d16eea450c350c1e738634cc
parentefbfd9027282e6f82f41edd32a1732d4a07e90a3 (diff)
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
-rw-r--r--win32/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/file.c b/win32/file.c
index 0f5b285..6452aad 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);