[newlib-cygwin] Cygwin: console: Fix argument of process_input_message() in read()

Takashi Yano tyan0@sourceware.org
Sun Sep 13 11:24:12 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2ac3428a93ddac0339c68859e97b910535f9bced

commit 2ac3428a93ddac0339c68859e97b910535f9bced
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Wed Aug 19 15:26:42 2026 +0900

    Cygwin: console: Fix argument of process_input_message() in read()
    
    The commit fac73911f5a0 ("Cygwin: console: Fix typeahead input for
    bash") introduced an argument to process_input_message() to restict
    the maximum length to be processed by this function. However, the
    commit failed to account for the number of chars already copied into
    the buffer.  This patch corrects the argument to process_input_message()
    to address this issue.
    
    Fixes: fac73911f5a0 ("Cygwin: console: Fix typeahead input for bash")
    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
    Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Diff:
---
 winsup/cygwin/fhandler/console.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index ba35ca44c..be41bf3a2 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -1273,7 +1273,7 @@ wait_retry:
 
       int ret;
       acquire_input_mutex (mutex_timeout);
-      ret = process_input_message (buflen);
+      ret = process_input_message (buflen - copied_chars);
       switch (ret)
 	{
 	case input_error:


More information about the Cygwin-cvs mailing list