aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-03-01 01:58:33 +0000
committerMichael Snyder <msnyder@vmware.com>2011-03-01 01:58:33 +0000
commit9e91a352064f48e0b806096988e03f6f4ebd35a0 (patch)
tree5b1a86badf081ad18ad81b0ba5325037e3782afb
parent28288541273e5c304eb056f4f408546dd0bdc75b (diff)
downloadgdb-9e91a352064f48e0b806096988e03f6f4ebd35a0.zip
gdb-9e91a352064f48e0b806096988e03f6f4ebd35a0.tar.gz
gdb-9e91a352064f48e0b806096988e03f6f4ebd35a0.tar.bz2
2011-02-28 Michael Snyder <msnyder@vmware.com>
* coffread.c (coff_getfilename): Add check to avoid overflow.
-rw-r--r--gdb/ChangeLog2
-rw-r--r--gdb/coffread.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b1b8bf9..557f89f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,7 @@
2011-02-28 Michael Snyder <msnyder@vmware.com>
+ * coffread.c (coff_getfilename): Add check to avoid overflow.
+
* objc-lang.c (selectors_info): Add a small safety margin to
avoid overflow.
(classes_info): Error out on too long REGEXP.
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 1566611..9df775d 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1316,7 +1316,11 @@ coff_getfilename (union internal_auxent *aux_entry)
char *result;
if (aux_entry->x_file.x_n.x_zeroes == 0)
- strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_offset);
+ {
+ if (strlen (stringtab + aux_entry->x_file.x_n.x_offset) >= BUFSIZ)
+ internal_error (__FILE__, __LINE__, _("coff file name too long"));
+ strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_offset);
+ }
else
{
strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);