diff options
-rw-r--r-- | win32/mingw.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index cd121c949..06da37040 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1381,10 +1381,9 @@ ssize_t readlink(const char *pathname, char *buf, size_t bufsiz) | |||
1381 | name[len] = 0; | 1381 | name[len] = 0; |
1382 | name = normalize_ntpath(name); | 1382 | name = normalize_ntpath(name); |
1383 | len = wcslen(name); | 1383 | len = wcslen(name); |
1384 | if (len >= bufsiz) | 1384 | if (len > bufsiz) |
1385 | len = bufsiz - 1; | 1385 | len = bufsiz; |
1386 | if (WideCharToMultiByte(CP_ACP, 0, name, len, buf, bufsiz, 0, 0)) { | 1386 | if (WideCharToMultiByte(CP_ACP, 0, name, len, buf, bufsiz, 0, 0)) { |
1387 | buf[len] = '\0'; | ||
1388 | return len; | 1387 | return len; |
1389 | } | 1388 | } |
1390 | } | 1389 | } |