0005-Return-early-from-_cursesi_waddbytes-if-_cursesi_add.patch (893B)
1 From c977aac84ce6c6e2737a8a072cb4116b8ee4278e Mon Sep 17 00:00:00 2001 2 From: Michael Forney <mforney@mforney.org> 3 Date: Thu, 3 Jun 2021 00:42:45 -0700 4 Subject: [PATCH] Return early from _cursesi_waddbytes if _cursesi_addwchar 5 fails 6 7 This error may indicate that scrolling was required in a non-scrolling 8 window, in which case the rest of the string should be truncated. 9 --- 10 lib/libcurses/addbytes.c | 2 +- 11 1 file changed, 1 insertion(+), 1 deletion(-) 12 13 diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c 14 index e52dc310..5d783df8 100644 15 --- a/lib/libcurses/addbytes.c 16 +++ b/lib/libcurses/addbytes.c 17 @@ -132,7 +132,7 @@ _cursesi_waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr, 18 #ifdef HAVE_WCHAR 19 (void)memset(&st, 0, sizeof(st)); 20 #endif 21 - while (count > 0) { 22 + while (count > 0 && err == OK) { 23 #ifndef HAVE_WCHAR 24 c = *bytes++; 25 #ifdef DEBUG 26 -- 27 2.31.1 28