]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* coffgen.c (_bfd_coff_get_external_symbols): Cast malloc return.
authorIan Lance Taylor <ian@airs.com>
Sat, 18 Nov 1995 23:04:26 +0000 (23:04 +0000)
committerIan Lance Taylor <ian@airs.com>
Sat, 18 Nov 1995 23:04:26 +0000 (23:04 +0000)
(_bfd_coff_read_string_table): Likewise.

bfd/ChangeLog
bfd/coffgen.c

index 5c55b957ed98d9ef45df9263372e9f4f8f251ab0..260117a58a1bfb2cd9e4bebb357e629a051fae8a 100644 (file)
@@ -1,3 +1,8 @@
+Sat Nov 18 18:01:41 1995  Ian Lance Taylor  <ian@cygnus.com>
+
+       * coffgen.c (_bfd_coff_get_external_symbols): Cast malloc return.
+       (_bfd_coff_read_string_table): Likewise.
+
 Sat Nov 18 19:43:04 1995  Richard Earnshaw (rearnsha@armltd.co.uk)
 
        * pe-arm.c: Fix typos.
index 9ccd2b7e8042dfd5d35eefb3aae9b32c0c6d254e..4bce970a83660f58db00c1da533f6ae83c7aaf0e 100644 (file)
@@ -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);