mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
Fix seg-fault in the binutils utilities when reading a corrupt input file.
PR binutils/20905 * peicode.h (pe_ILF_object_p): Use strnlen to avoid running over the end of the string buffer.
This commit is contained in:
parent
406bd128db
commit
fa6631b4ee
@ -5,6 +5,10 @@
|
||||
|
||||
2016-12-05 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/20905
|
||||
* peicode.h (pe_ILF_object_p): Use strnlen to avoid running over
|
||||
the end of the string buffer.
|
||||
|
||||
PR binutils/20907
|
||||
* peicode.h (pe_ILF_build_a_bfd): Replace abort with error return.
|
||||
|
||||
|
@ -1269,7 +1269,8 @@ pe_ILF_object_p (bfd * abfd)
|
||||
}
|
||||
|
||||
symbol_name = (char *) ptr;
|
||||
source_dll = symbol_name + strlen (symbol_name) + 1;
|
||||
/* See PR 20905 for an example of where the strnlen is necessary. */
|
||||
source_dll = symbol_name + strnlen (symbol_name, size - 1) + 1;
|
||||
|
||||
/* Verify that the strings are null terminated. */
|
||||
if (ptr[size - 1] != 0
|
||||
|
Loading…
Reference in New Issue
Block a user