I forgot a lot. I put ANSI in it.
I have not written a test yet.
To write only C is a little loss...
----
Nobuhiro Takasaki
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/os_win32.c b/src/os_win32.c
index 8065ee858..b7a9f5daa 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -3109,6 +3109,7 @@ mch_dirname(
int len)
{
char_u abuf[_MAX_PATH + 1];
+ DWORD lfnlen;
/*
* Originally this was:
@@ -3126,7 +3127,8 @@ mch_dirname(
WCHAR wcbuf[_MAX_PATH + 1];
char_u *p;
- if (GetLongPathNameW(wbuf, wcbuf, _MAX_PATH) != 0)
+ lfnlen = GetLongPathNameW(wbuf, wcbuf, _MAX_PATH);
+ if (lfnlen != 0 && lfnlen < _MAX_PATH)
p = utf16_to_enc(wcbuf, NULL);
else
p = utf16_to_enc(wbuf, NULL);
@@ -3143,7 +3145,8 @@ mch_dirname(
#endif
if (GetCurrentDirectory(len, (LPSTR)buf) == 0)
return FAIL;
- if (GetLongPathNameA((LPSTR)buf, (LPSTR)abuf, _MAX_PATH) == 0)
+ lfnlen = GetLongPathNameA((LPSTR)buf, (LPSTR)abuf, _MAX_PATH);
+ if (lfnlen == 0 || lfnlen > _MAX_PATH)
// return the short path name
return OK;