mirror of
https://github.com/reactos/wine.git
synced 2025-02-12 23:58:56 +00:00
cmd: Handle truncation for console reads.
This commit is contained in:
parent
e3a72698c1
commit
5e8893f2f6
@ -199,7 +199,12 @@ WCHAR *WCMD_fgets(WCHAR *s, int noChars, HANDLE h, BOOL is_console_handle)
|
||||
if (is_console_handle) {
|
||||
status = ReadConsoleW(h, s, noChars, &charsRead, NULL);
|
||||
if (!status) return NULL;
|
||||
s[charsRead-2] = '\0'; /* Strip \r\n */
|
||||
if (s[charsRead-2] == '\r')
|
||||
s[charsRead-2] = '\0'; /* Strip \r\n */
|
||||
else {
|
||||
/* Truncate */
|
||||
s[noChars-1] = '\0';
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user