From: David Taylor <dtaylor@emc.com>
To: gdb-patches@sourceware.org
Cc: dtaylor@emc.com
Subject: [PATCH] symtab.c -- Fix off by one allocation bug
Date: Mon, 13 Jun 2016 17:58:00 -0000 [thread overview]
Message-ID: <31327.1465840699@usendtaylorx2l> (raw)
This fixes a problem found by valgrind. Applying this patch caused no
regressions on GNU/Linux x86-64 and satisfied valgrind.
* gdb/symtab.c (symbol_set_names): Fix off by one error in
allocation.
---
gdb/ChangeLog | 4 ++++
gdb/symtab.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9c09269..aaeeb6e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-09 David Taylor <dtaylor@emc.com>
+
+ * symtab.c (symbol_set_names): Fix off by one error in allocation.
+
2016-06-07 Simon Marchi <simon.marchi@ericsson.com>
* mi/mi-interp.c (mi_record_changed): Add missing braces.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f7a207a..12e1cf5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1010,7 +1010,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
= ((struct demangled_name_entry *)
obstack_alloc (&per_bfd->storage_obstack,
offsetof (struct demangled_name_entry, demangled)
- + lookup_len + demangled_len + 2));
+ + lookup_len + demangled_len + 3));
mangled_ptr = &((*slot)->demangled[demangled_len + 1]);
strcpy (mangled_ptr, lookup_name);
(*slot)->mangled = mangled_ptr;
--
1.9.1
next reply other threads:[~2016-06-13 17:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 17:58 David Taylor [this message]
2016-06-13 18:23 ` Joel Brobecker
2016-06-16 16:26 ` taylor, david
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=31327.1465840699@usendtaylorx2l \
--to=dtaylor@emc.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