[PATCH] cmd.exe: increase size of WCMD_HandleTildeModifiers() buffers to MAXSTRING

Damjan Jovanovic damjan.jov at gmail.com
Fri Nov 13 10:09:59 CST 2020


Some buffers in WCMD_HandleTildeModifiers() are only of size MAX_PATH,
even though
they handle strings that aren't necessarily filenames. When changed to have size
MAXSTRING, a stack overflow crash with strings of size MAX_PATH stops happening.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42731
Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 programs/cmd/batch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index 3aa40874aea..a08648d8c26 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -342,8 +342,8 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
   };
 
   WIN32_FILE_ATTRIBUTE_DATA fileInfo;
-  WCHAR  outputparam[MAX_PATH];
-  WCHAR  finaloutput[MAX_PATH];
+  WCHAR  outputparam[MAXSTRING];
+  WCHAR  finaloutput[MAXSTRING];
   WCHAR  fullfilename[MAX_PATH];
   WCHAR  thisoutput[MAX_PATH];
   WCHAR  *filepart       = NULL;


More information about the wine-devel mailing list