From 7c99fa02f9f1ac7d2dff2dc4f496ccbc715526df Mon Sep 17 00:00:00 2001 From: Jehan Date: Thu, 25 Nov 2021 09:53:00 +0100 Subject: [PATCH] libgimpbase: read up to 255 bytes into a 256 bytes buffer. Otherwise if we add a NUL byte after the last byte, we might right past the allocated memory. Thanks to Massimo for reporting this error raised by Address Sanitizer and valgrind (cf. #7539). --- libgimpbase/gimputils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c index 03892e030e..1b07acee57 100644 --- a/libgimpbase/gimputils.c +++ b/libgimpbase/gimputils.c @@ -1342,7 +1342,7 @@ gimp_stack_trace_print (const gchar *prog_name, */ close (out_fd[1]); - while ((read_n = read (out_fd[0], buffer, 256)) != 0) + while ((read_n = read (out_fd[0], buffer, 255)) != 0) { if (read_n < 0) {