Hi,

Vim crashes on Windows when opening very long filename if enc is utf-8.

How to reproduce:

1. Create a file with very long name.

echo 
foo>aaああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ.txt

Note that this filename is shorter than MAX_PATH (260) bytes in the current
codepage, but longer than MAX_PATH bytes in utf-8.

2. Open the file with a wildcard. 'enc' should be utf-8.

vim -u NONE --cmd "set enc=utf-8" aa*.txt


This is caused by that allocated buffer is not enough.
Following patch fixes this:

--- a/src/misc1.c
+++ b/src/misc1.c
@@ -9941,7 +9941,7 @@ dos_expandpath(
     }
 
     /* make room for file name */
-    buf = alloc((int)STRLEN(path) + BASENAMELEN + 5);
+    buf = alloc(MAXPATHL);
     if (buf == NULL)
        return 0;
 

Regards,
Ken Takata

-- 
-- 
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.

Raspunde prin e-mail lui