[PATCH] gdb: Don't print NUL with "Recursive internal problem."
Thiago Macieira <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
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