From: David Anderson <davea@quasar.engr.sgi.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] register name too long leads to botch
Date: Tue, 11 Oct 2005 14:14:00 -0000 [thread overview]
Message-ID: <200510101528.j9AFSoOV040655@quasar.engr.sgi.com> (raw)
I noticed that some code is unsafe with register names longer than
15 characters.
infcmd.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file);
ms1-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
ms1-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
ms1-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
sh-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
sh-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
sh64-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
sh64-tdep.c: print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file)
We have some user-named 'registers' so names did get longer,
and that did crash gdb and/or print garbage.
Approved?
2005-10-10 David Anderson <davea@sgi.com>
* utils.c (n_spaces): Turn negative argument to zero.
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.162
diff -p -u -p -r1.162 utils.c
--- utils.c 31 Jul 2005 20:56:26 -0000 1.162
+++ utils.c 10 Oct 2005 15:17:06 -0000
@@ -2291,6 +2291,8 @@ n_spaces (int n)
static char *spaces = 0;
static int max_spaces = -1;
+ if(n < 0)
+ n = 0;
if (n > max_spaces)
{
if (spaces)
David Anderson.
reply other threads:[~2005-10-11 14:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200510101528.j9AFSoOV040655@quasar.engr.sgi.com \
--to=davea@quasar.engr.sgi.com \
--cc=gdb-patches@sources.redhat.com \
/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