* [PATCH] gdb: Don't print NUL with "Recursive internal problem."
@ 2026-08-20 20:56 Thiago Macieira
2026-08-21 15:07 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Thiago Macieira @ 2026-08-20 20:56 UTC (permalink / raw)
To: gdb-patches; +Cc: Thiago Macieira
Off-by-one error. The sizeof(msg) includes the NUL character, which we
don't want printed.
---
gdb/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/utils.c b/gdb/utils.c
index 876aad1c448..ada109b221c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -370,7 +370,7 @@ internal_vproblem (struct internal_problem *problem,
ignoring the return value is correct. Casting to (void)
does not fix this problem. This is the solution suggested
at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */
- if (write (STDERR_FILENO, msg, sizeof (msg)) != sizeof (msg))
+ if (write (STDERR_FILENO, msg, sizeof (msg) - 1) != sizeof (msg) - 1)
abort (); /* ARI: abort */
exit (1);
}
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-21 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-20 20:56 [PATCH] gdb: Don't print NUL with "Recursive internal problem." Thiago Macieira
2026-08-21 15:07 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox