From 0efe869474fabf3ba6a05a85763cb1677089352d Mon Sep 17 00:00:00 2001 From: Eric Branlund Date: Tue, 21 Jun 2022 10:09:49 -0600 Subject: [PATCH] Backport change from 3.0.0: GCU: use waddnstr() in the text hook rather than using a fixed size temporary buffer to insert a terminating null character --- src/main-gcu.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main-gcu.c b/src/main-gcu.c index d7ffac875..099cf7057 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -1093,10 +1093,6 @@ static errr Term_text_gcu(int x, int y, int n, byte a, concptr s) { term_data *td = (term_data *)(Term->data); - int i; - - char text[81]; - #ifdef USE_NCURSES_ACS /* do we have colors + 16 ? */ /* then call special routine for drawing special characters */ @@ -1107,9 +1103,6 @@ static errr Term_text_gcu(int x, int y, int n, byte a, concptr s) } #endif - /* Obtain a copy of the text */ - for (i = 0; i < n; i++) text[i] = s[i]; text[n] = 0; - /* Move the cursor and dump the string */ wmove(td->win, y, x); @@ -1119,7 +1112,7 @@ static errr Term_text_gcu(int x, int y, int n, byte a, concptr s) #endif /* Add the text */ - waddstr(td->win, text); + waddnstr(td->win, s, n); /* Success */ return (0); -- 2.11.0