Fix illegal memory accesses in readelf when parsing a corrupt binary.
[binutils-gdb.git] / binutils / rddbg.c
index ae25decd654e0c9e24b899539b9ba45e2d4fbbda..1d8c4471887c29877ef23d021b05bb5b22ca9c61 100644 (file)
@@ -299,7 +299,10 @@ read_symbol_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
          *pfound = TRUE;
 
          s = i.name;
+         if (s == NULL || strlen (s) < 1)
+           return FALSE;
          f = NULL;
+
          while (s[strlen (s) - 1] == '\\'
                 && ps + 1 < symend)
            {