aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-11-18 23:04:26 +0000
committerIan Lance Taylor <ian@airs.com>1995-11-18 23:04:26 +0000
commit90a7abbca34a2c0b8500bcde40489a2981e62dca (patch)
tree0f3be2a4e5a19029cdcec615fe3002dd113fc725 /bfd/coffgen.c
parent177b193219054d4dc1c6889b35f7ec594ece190f (diff)
downloadgdb-90a7abbca34a2c0b8500bcde40489a2981e62dca.zip
gdb-90a7abbca34a2c0b8500bcde40489a2981e62dca.tar.gz
gdb-90a7abbca34a2c0b8500bcde40489a2981e62dca.tar.bz2
* coffgen.c (_bfd_coff_get_external_symbols): Cast malloc return.
(_bfd_coff_read_string_table): Likewise.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 9ccd2b7..4bce970 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1481,7 +1481,7 @@ _bfd_coff_get_external_symbols (abfd)
size = obj_raw_syment_count (abfd) * symesz;
- syms = malloc (size);
+ syms = (PTR) malloc (size);
if (syms == NULL && size != 0)
{
bfd_set_error (bfd_error_no_memory);
@@ -1539,7 +1539,16 @@ _bfd_coff_read_string_table (abfd)
#endif
}
- strings = malloc (strsize);
+ if (strsize < STRING_SIZE_SIZE)
+ {
+ (*_bfd_error_handler)
+ ("%s: bad string table size %lu", bfd_get_filename (abfd),
+ (unsigned long) strsize);
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
+ strings = (char *) malloc (strsize);
if (strings == NULL)
{
bfd_set_error (bfd_error_no_memory);