2011-02-28 Michael Snyder <msnyder@vmware.com>

* coffread.c (coff_getfilename): Add check to avoid overflow.
This commit is contained in:
Michael Snyder 2011-03-01 01:58:33 +00:00
parent 2828854127
commit 9e91a35206
2 changed files with 7 additions and 1 deletions

View File

@ -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.

View File

@ -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);