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).
This commit is contained in:
Jehan 2021-11-25 09:53:00 +01:00
parent 08eba7fde7
commit 7c99fa02f9

View file

@ -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)
{