Thumbnail

rani/cscroll.git

Clone URL: https://git.buni.party/rani/cscroll.git

commit 06ef3518f36f3209614e7d779b72be6705c594fb Author: rani <clagv.randomgames@gmail.com> Date: Sat Oct 01 18:16:49 2022 +0000 Fix buffer overflow in curses_getline() diff --git a/src/io.c b/src/io.c index 36ffa78..c807d30 100644 --- a/src/io.c +++ b/src/io.c @@ -3416 +34111 @@ char * curses_getline(char * p) {   size_t l = 0;   char c;   while ((c = getch()) != '\n') { + if (l % 127 == 0) { + // add 1 to size as l starts at 0 + inp = realloc(inp, l + 129); + } +   if (c == 127) {   if (l > 0) l--;   addch(' ');