The command `echo | wine cmd /k 'label c:'` causes WCMD_ReadFile to return the single character '\n' without a null terminator, which would then cause garbage to be written to ~/.wine/drive_c/.windows-label.
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- programs/cmd/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 963a9eaf361..dc7f0461433 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -4718,8 +4718,8 @@ int WCMD_volume(BOOL set_label, const WCHAR *path) if (set_label) { WCMD_output (WCMD_LoadMessage(WCMD_VOLUMEPROMPT)); WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, ARRAY_SIZE(string), &count); + string[count-1] = '\0'; /* ReadFile output is not null-terminated! */ if (count > 1) { - string[count-1] = '\0'; /* ReadFile output is not null-terminated! */ if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */ } if (*path) {