On 15-Mar-2025 20:00, Christian Brabandt wrote:
patch 9.1.1204: MS-Windows: crash when passing long string to expand()
Commit:https://github.com/vim/vim/commit/00a749bd90e6b84e7e5132691d73fe9aa3fdff05
Author: zeertzjq<zeert...@outlook.com>
Date: Sat Mar 15 09:53:32 2025 +0100
patch 9.1.1204: MS-Windows: crash when passing long string to expand()
Problem: MS-Windows: crash when passing long string to expand() with
'wildignorecase'.
Solution: Use the same buflen as unix_expandpath() in dos_expandpath().
Remove an unnecessary STRLEN() while at it (zeertzjq).
closes: #16896
Signed-off-by: zeertzjq<zeert...@outlook.com>
Signed-off-by: Christian Brabandt<c...@256bit.org>
After this patch, clang (v20.1.0 on Win11 x64) generates this warning:
<snip>
clang -c -I. -Iproto -DWIN32 -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE -Db_lto=true
-Db_lto_mode=thin -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD filepath.c -o
gobjx86-64/filepath.o
filepath.c:3597:18: warning: passing 'char_u *' (aka 'unsigned char *')
to parameter of type 'char *' converts between pointers to integer types
where one is of the unique plain 'char' type and the other is not
[-Wpointer-sign]
3597 | vim_snprintf(s, buflen - len, "*.*");
| ^
./proto.h:142:24: note: passing argument to parameter here
142 | int vim_snprintf(char *, size_t, const char *, ...)
ATTRIBUTE_FORMAT_PRINTF(3, 4);
| ^
1 warning generated.
</snip>
The attached patch corrects it.
Cheers
John
--
--
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/1da340f7-02b2-4a64-b169-27519cc06018%40internode.on.net.
--- filepath.c.20250316-080445 2025-03-16 08:04:45 +1100
+++ filepath.c 2025-03-16 08:07:50 +1100
@@ -3594,7 +3594,7 @@
}
// Scan all files in the directory with "dir/ *.*"
- vim_snprintf(s, buflen - len, "*.*");
+ vim_snprintf((char *)s, buflen - len, "*.*");
wn = enc_to_utf16(buf, NULL);
if (wn != NULL)
hFind = FindFirstFileW(wn, &wfb);