diff --git a/src/elfxx.c b/src/elfxx.c index 06cc9bb6..7ed44bac 100644 --- a/src/elfxx.c +++ b/src/elfxx.c @@ -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); }