mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01:00
Improve ELF valid_object() helper
Ensures the ELF header version is valid. Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
This commit is contained in:
parent
af88cab09f
commit
5007f8c794
1 changed files with 4 additions and 2 deletions
|
@ -32,11 +32,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|||
HIDDEN int
|
||||
elf_w (valid_object) (struct elf_image *ei)
|
||||
{
|
||||
if (ei->size <= EI_CLASS)
|
||||
if (ei->size <= EI_VERSION)
|
||||
return 0;
|
||||
|
||||
return (memcmp (ei->image, ELFMAG, SELFMAG) == 0
|
||||
&& ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS);
|
||||
&& ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS
|
||||
&& ((uint8_t *) ei->image)[EI_VERSION] != EV_NONE
|
||||
&& ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue