From 2ecafb0e4e31c7aa63e5f95fa24dbac10d5c2e8b Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 14 Jan 2020 20:08:45 -0500 Subject: Ensure ansi resets formatting and null-terminates fmemopen in text-mode only ensures the buffer is null-terminated if the last write does not fill the buffer. --- scoop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scoop.c b/scoop.c index 241ef3e..006a416 100644 --- a/scoop.c +++ b/scoop.c @@ -123,8 +123,10 @@ static const char *ansi(const char *str) { } } } - + fprintf(out, "\33[m"); fclose(out); + + buf[sizeof(buf) - 1] = '\0'; return buf; } -- cgit 1.4.1