From 47a5e37ba38f69de2c4ab2a5c14bc1adb4ce46c7 Mon Sep 17 00:00:00 2001 From: Trevor White Date: Wed, 22 Mar 2023 18:38:24 -0400 Subject: [PATCH] Fixes issue of medium to large prompts causing crashing with no errors while using color mode. - This fixes a major application breaking untraceable error (Large prompts crashing with no error output #122) - Tested and working --- chat.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chat.cpp b/chat.cpp index 22f0a4ddf4a05..3b0fb90dbae7f 100644 --- a/chat.cpp +++ b/chat.cpp @@ -1041,10 +1041,10 @@ int main(int argc, char ** argv) { bool another_line=true; while (another_line) { fflush(stdout); - char buf[256] = {0}; + char buf[16384] = { 0 }; int n_read; - if(params.use_color) printf(ANSI_BOLD ANSI_COLOR_GREEN); - if (scanf("%255[^\n]%n%*c", buf, &n_read) <= 0) { + if (params.use_color) printf(ANSI_BOLD ANSI_COLOR_GREEN); + if (scanf("%16383[^\n]%n%*c", buf, &n_read) <= 0) { // presumable empty line, consume the newline if (scanf("%*c") <= 0) { /*ignore*/ } n_read=0;