Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thiago Macieira <thiago.macieira@intel.com>
To: gdb-patches@sourceware.org
Cc: Thiago Macieira <thiago.macieira@intel.com>
Subject: [PATCH] gdb: Don't print NUL with "Recursive internal problem."
Date: Thu, 20 Aug 2026 13:56:05 -0700	[thread overview]
Message-ID: <20260820205605.16997-1-thiago.macieira@intel.com> (raw)

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


             reply	other threads:[~2026-08-20 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 20:56 Thiago Macieira [this message]
2026-08-21 15:07 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260820205605.16997-1-thiago.macieira@intel.com \
    --to=thiago.macieira@intel.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox