[gimp] libgimpbase: read up to 255 bytes into a 256 bytes buffer.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpbase: read up to 255 bytes into a 256 bytes buffer.
- Date: Thu, 25 Nov 2021 08:56:35 +0000 (UTC)
commit 7c99fa02f9f1ac7d2dff2dc4f496ccbc715526df
Author: Jehan <jehan girinstud io>
Date: Thu Nov 25 09:53:00 2021 +0100
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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]