summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);