summaryrefslogtreecommitdiff
path: root/gdb/coffread.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2011-03-01 01:58:32 +0000
committerMichael Snyder <msnyder@specifix.com>2011-03-01 01:58:32 +0000
commit0bf07cb790909a1eac146b28c7533aeeb389a64f (patch)
treef62dac7c370af515eb47d0e20b9456c274cbaf62 /gdb/coffread.c
parenta9fd35627defc77e0864835ebaa95785c0cb70b0 (diff)
downloadgdb-0bf07cb790909a1eac146b28c7533aeeb389a64f.tar.gz
2011-02-28 Michael Snyder <msnyder@vmware.com>
* coffread.c (coff_getfilename): Add check to avoid overflow.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r--gdb/coffread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 156661128e2..9df775d46b9 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);