[binutils-gdb] Fix check for buffer overflow when processing version information.

Nick Clifton nickc@sourceware.org
Mon Feb 13 14:38:00 GMT 2017


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4aeb00ad3cc6a29b32f0a4e42c2f64d55e25b76d

commit 4aeb00ad3cc6a29b32f0a4e42c2f64d55e25b76d
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Feb 13 14:35:24 2017 +0000

    Fix check for buffer overflow when processing version information.
    
    	PR binutils/21148
    	* readelf.c (process_version_sections): Include size of auxillary
    	version information when checking for buffer overflow.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/readelf.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f099467..ebaedcc 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,11 @@
 2017-02-13  Nick Clifton  <nickc@redhat.com>
 
+	PR binutils/21148
+	* readelf.c (process_version_sections): Include size of auxillary
+	version information when checking for buffer overflow.
+
+2017-02-13  Nick Clifton  <nickc@redhat.com>
+
 	PR binutils/21147
 	* readelf.c (process_section_contents): Fix off by one error
 	reporting un-dumped sections.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 6fd7ff7..a61befe 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -10019,7 +10019,7 @@ process_version_sections (FILE * file)
 			ent.vd_ndx, ent.vd_cnt);
 
 		/* Check for overflow.  */
-		if (ent.vd_aux > (size_t) (endbuf - vstart))
+		if (ent.vd_aux + sizeof (* eaux) > (size_t) (endbuf - vstart))
 		  break;
 
 		vstart += ent.vd_aux;



More information about the Binutils-cvs mailing list