=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: cmd: Handle truncation for console reads.
Alexandre Julliard
julliard at winehq.org
Mon Oct 3 17:21:24 CDT 2011
Module: wine
Branch: master
Commit: 5e8893f2f6b259a26ed5bfb7e3b4ea4580145445
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e8893f2f6b259a26ed5bfb7e3b4ea4580145445
Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date: Sat Oct 1 13:43:18 2011 +0200
cmd: Handle truncation for console reads.
---
programs/cmd/batch.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index 52dd08e..5f83c35 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -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;
}
More information about the wine-cvs
mailing list