Make sure filter buffer has room for the double terminator

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7175 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2020-04-22 21:37:01 +00:00
parent c14e5f0aa3
commit 2e11d853b7

View file

@ -89,11 +89,11 @@ void __declspec(dllexport) SelectFolderDialog(HWND hwndParent, int string_size,
void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
{ {
OPENFILENAME ofn={0,}; // XXX WTF OPENFILENAME ofn={0,};
int save; int save;
TCHAR type[5]; TCHAR type[5];
static TCHAR path[1024]; static TCHAR path[1024];
static TCHAR filter[1024]; static TCHAR filter[1024+1];
static TCHAR currentDirectory[1024]; static TCHAR currentDirectory[1024];
static TCHAR initialDir[1024]; static TCHAR initialDir[1024];
DWORD gfa; DWORD gfa;
@ -110,7 +110,7 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TC
popstringn(type, COUNTOF(type)); popstringn(type, COUNTOF(type));
popstringn(path, COUNTOF(path)); popstringn(path, COUNTOF(path));
popstringn(filter, COUNTOF(filter)); popstringn(filter, COUNTOF(filter)-1);
save = !lstrcmpi(type, _T("save")); save = !lstrcmpi(type, _T("save"));
@ -133,7 +133,7 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TC
// Convert the filter to the format required by Windows: NULL after each // Convert the filter to the format required by Windows: NULL after each
// item followed by a terminating NULL // item followed by a terminating NULL
TCHAR *p = filter; TCHAR *p = filter;
while (*p) // XXX take care for 1024 while (*p)
{ {
if (*p == _T('|')) if (*p == _T('|'))
{ {