Commit Graph

92 Commits

Author SHA1 Message Date
Eric Pouech 23817bb8d9 cmd: Bail out when full path name exceeds MAX_PATH.
This mimics native behavior and prevents buffer overflows.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-25 20:50:49 +01:00
Jacek Caban 2ecb871310 cmd: Don't use WCMD_is_console_handle.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:50:20 +01:00
Michael Stefaniuc 9fcb2b097c cmd: Inline some simple extern WCHAR strings.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 21:36:12 +01:00
Damjan Jovanovic abe848f05f cmd.exe: Increase size of WCMD_HandleTildeModifiers() buffers to MAXSTRING.
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@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-17 21:16:43 +01:00
Zebediah Figura 16c938cb66 cmd: Fix the spelling of "tilde".
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 11:32:05 +02:00
Zebediah Figura 60b3db6b98 cmd: Use _wsplitpath() from msvcrt.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 11:32:03 +02:00
Gijs Vermeulen 5fd548fc9b cmd: Use wide character string literals in batch.c.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-25 19:25:47 +01:00
Alexandre Julliard 43c430a6d8 cmd: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 16:30:39 +02:00
Michael Stefaniuc 44bda237ed cmd: Avoid naming conflicts with the global HeapAlloc wrappers.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-26 12:21:39 +01:00
Jason Edmeades 987fee3791 cmd: Correct handling of %~0 for batch call.
When a batch label is called, %0 and %~0 should be the label being
called, and if you start adding modifiers to it (eg %~d0) then you get
details of the batch program containing the label.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44369
Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-29 22:01:38 +02:00
Jason Edmeades 5c444c4e0d cmd: Fix shortpath handling in for loops.
When 's' is used as a modifier, the paths that are presented to the
other modifiers needs to be a short path. Given the 'filename' part of
the path may not exist, we cannot use GetShortPathName directly
without first removing the filename part to just leave the directory
bit.

Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-29 22:01:38 +02:00
Michael Stefaniuc 04413abcc7 cmd: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-21 23:02:30 +02:00
Bruno Jesus 5a469f1b87 cmd: Ensure environment variables fit in memory. 2015-01-06 18:20:01 +01:00
Jason Edmeades 2b9649d9db cmd: Fix tilda parameter expansion when arg is empty. 2013-06-04 21:01:13 +02:00
Jason Edmeades 0b00b717b9 cmd: Add beginnings of support for delayed expansion. 2013-01-07 11:15:23 +01:00
Jason Edmeades d71f5c9483 cmd: Prevent overflow for long command string. 2012-11-27 19:45:38 +01:00
Jacek Caban 08c17ada57 cmd: Added HeapFree wrapper. 2012-11-16 11:40:36 +01:00
Jacek Caban c6d24089db cmd: Make allocation unfailable. 2012-11-15 21:21:53 +01:00
Jason Edmeades ae4571fb79 cmd: Fix for loops within for loops. 2012-11-06 16:02:41 +01:00
Frédéric Delanoy cee1652e61 cmd: Get rid of longer needed 'end' parameter in WCMD_parameter. 2012-10-26 11:59:58 +02:00
Jason Edmeades 51b0d941d0 cmd: Add for /f delims= support. 2012-10-24 11:30:43 +02:00
Jason Edmeades 9171fd1454 cmd: Add support for usebackq (for /f). 2012-10-24 11:30:11 +02:00
Akihiro Sagawa 8daef1649b cmd: Properly handle multibyte characters in batch files. 2012-10-22 12:23:26 +02:00
Jason Edmeades 3c05818515 cmd: Add support for calling a built in command. 2012-10-17 11:59:34 +02:00
Jason Edmeades dccccfc273 cmd: Handle very odd delimiter support for command line. 2012-10-17 11:57:23 +02:00
Jason Edmeades 8f019b1111 cmd: Fix some issues with ~ modifier expansion. 2012-10-15 15:25:14 +02:00
Jason Edmeades c55cd87632 cmd: Fix setlocal/endlocal implementation. 2012-10-01 14:30:49 +02:00
Frédéric Delanoy 8b3d494247 cmd: Spelling fixes. 2012-09-28 17:14:34 +02:00
Jason Edmeades e35b239b41 cmd: Fix parameterization around delimiters. 2012-09-26 17:47:20 +02:00
Frédéric Delanoy 0f032203f5 cmd: Improve WCMD_parameter documentation. 2012-05-16 20:27:28 +02:00
Frédéric Delanoy 0e4ceb9a8d cmd: Use BOOL instead of int for boolean variables. 2012-03-29 20:49:18 +02:00
Frédéric Delanoy 668e44ab26 cmd: Respect constant wide strings naming convention. 2012-02-13 12:29:34 +01:00
Frédéric Delanoy 44a1e7d199 cmd: Move commonly used global vars declarations to header file. 2011-11-30 11:44:05 +01:00
Frédéric Delanoy 5fc25686a4 cmd: Avoid duplication of commonly used strings. 2011-11-15 11:45:58 +01:00
Frédéric Delanoy 6221e300bc cmd: Avoid comparison between signed and unsigned values. 2011-11-08 13:55:14 +01:00
Frédéric Delanoy 6d01f15a27 cmd: Rename a parameter in WCMD_parameter. 2011-10-31 16:48:33 +01:00
Frédéric Delanoy cd30c52b35 cmd: Avoid reading char by char from files. 2011-10-06 16:46:41 -05:00
Frédéric Delanoy 5e3cb1867b cmd: Infer handle type from handle value in WCMD_fgets and WCMD_ReadAndParseLine. 2011-10-06 16:46:41 -05:00
Frédéric Delanoy d25f614c51 cmd: Rename a parameter in WCMD_fgets. 2011-10-05 17:00:12 -05:00
Frédéric Delanoy 5e8893f2f6 cmd: Handle truncation for console reads. 2011-10-03 09:46:11 -05:00
Frédéric Delanoy e3a72698c1 cmd: Improve WCMD_fgets documentation. 2011-10-03 09:45:49 -05:00
Frédéric Delanoy 29b57ca82d cmd: Get rid of unused parameter in WCMD_ReadFile. 2011-09-28 17:29:24 +02:00
Frédéric Delanoy d6f4f7308a cmd: Avoid checking whether we're in console mode for every read. 2011-09-28 17:29:10 +02:00
Frédéric Delanoy a7e1c22a48 cmd: Avoid reading char by char from console. 2011-09-28 17:27:08 +02:00
Frédéric Delanoy 83daee9a89 cmd: Fix WCMD_fgets documentation. 2011-09-26 22:42:01 +02:00
Frédéric Delanoy 9c61656307 cmd: Output error messages to stderr where appropriate. 2011-09-26 22:42:01 +02:00
Frédéric Delanoy bf63385fab cmd: Remove unused declarations of echo_mode. 2011-09-16 17:24:15 +02:00
Frédéric Delanoy a33bad1edd cmd: Allow a batch file to delete itself. 2011-09-12 16:49:56 +02:00
Frédéric Delanoy 3627c28958 cmd: Add an output parameter to WCMD_parameter to point to the end of the extracted param, if requested. 2011-09-08 20:08:07 +02:00
Frédéric Delanoy 7b9af22682 cmd: Simplify WCMD_parameter function. 2011-09-08 20:08:07 +02:00