From 79fcfa10f48e539001da1288f7a084f07b895abf Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 20 Dec 2020 15:49:57 +0100 Subject: [PATCH] print the exact amount of mmap'd data It could read past the mmap'd region (not using the NUL terminator). Signed-off-by: Christoph Lohmann <20h@r-36.net> --- catpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catpoint.c b/catpoint.c index da4ab1f..52853a6 100644 --- a/catpoint.c +++ b/catpoint.c @@ -63,7 +63,7 @@ reloadcurrentslide(int sig) if (sig == SIGHUP) { clear(); refresh(); - printw("%s", currentslidep); + printw("%.*s", currentslidelen, currentslidep); } } @@ -109,7 +109,7 @@ show: loadcurrentslide(slidefiles, currentslide); clear(); refresh(); - printw("%s", currentslidep); + printw("%.*s", currentslidelen, currentslidep); again: c = getch();