Browse Source

Fix illegal memory access bug in nm when run on a corrupt binary.

PR binutils/21150
	* nm.c (file_symbol): Add test of string length before testing
	string characters.
gdb-8.0-branch
Nick Clifton 10 years ago
parent
commit
c12214021d
  1. 6
      binutils/ChangeLog
  2. 3
      binutils/nm.c

6
binutils/ChangeLog

@ -1,3 +1,9 @@
2017-02-13 Nick Clifton <nickc@redhat.com>
PR binutils/21150
* nm.c (file_symbol): Add test of string length before testing
string characters.
2017-02-13 Nick Clifton <nickc@redhat.com>
PR binutils/21135

3
binutils/nm.c

@ -685,7 +685,8 @@ size_forward1 (const void *P_x, const void *P_y)
#define file_symbol(s, sn, snl) \
(((s)->flags & BSF_FILE) != 0 \
|| ((sn)[(snl) - 2] == '.' \
|| ((snl) > 2 \
&& (sn)[(snl) - 2] == '.' \
&& ((sn)[(snl) - 1] == 'o' \
|| (sn)[(snl) - 1] == 'a')))

Loading…
Cancel
Save