Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Oct 2018 18:47:45 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339473 - head/contrib/elftoolchain/libelf
Message-ID:  <201810201847.w9KIljk5051145@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sat Oct 20 18:47:45 2018
New Revision: 339473
URL: https://svnweb.freebsd.org/changeset/base/339473

Log:
  libelf: also test for 64-bit ELF in _libelf_is_mips64el
  
  Although _libelf_is_mips64el is only called in contexts where we've
  already checked that e_class is ELFCLASS64 but this may change in the
  future.  Add a safety belt so that we don't access an invalid e_ehdr64
  union member if it does.
  
  Reported by:	jkoshy (in review D17380)

Modified:
  head/contrib/elftoolchain/libelf/gelf_mips64el.c

Modified: head/contrib/elftoolchain/libelf/gelf_mips64el.c
==============================================================================
--- head/contrib/elftoolchain/libelf/gelf_mips64el.c	Sat Oct 20 18:46:36 2018	(r339472)
+++ head/contrib/elftoolchain/libelf/gelf_mips64el.c	Sat Oct 20 18:47:45 2018	(r339473)
@@ -34,7 +34,7 @@ int
 _libelf_is_mips64el(Elf *e)
 {
 
-	return (e->e_kind == ELF_K_ELF &&
+	return (e->e_kind == ELF_K_ELF && e->e_class == ELFCLASS64 &&
 	    e->e_u.e_elf.e_ehdr.e_ehdr64->e_machine == EM_MIPS &&
 	    e->e_u.e_elf.e_ehdr.e_ehdr64->e_ident[EI_DATA] == ELFDATA2LSB);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810201847.w9KIljk5051145>