|
|
092ea1 |
From f8ba1437114e408de0f66efb272fdc1de986017a Mon Sep 17 00:00:00 2001
|
|
|
092ea1 |
From: Vincent Mihalkovic <vmihalko@redhat.com>
|
|
|
092ea1 |
Date: Mon, 6 Feb 2023 14:39:58 +0100
|
|
|
092ea1 |
Subject: [PATCH] We need to process the dynamic section so that we can set $x
|
|
|
092ea1 |
for mime.
|
|
|
092ea1 |
|
|
|
092ea1 |
9ffbd485ba4647827c4bdacf3a2de690f6765b0c
|
|
|
092ea1 |
---
|
|
|
092ea1 |
src/readelf.c | 12 +++++++++++-
|
|
|
092ea1 |
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
|
092ea1 |
|
|
|
092ea1 |
diff --git a/src/readelf.c b/src/readelf.c
|
|
|
092ea1 |
index cdc211f..94cdaca 100644
|
|
|
092ea1 |
--- a/src/readelf.c
|
|
|
092ea1 |
+++ b/src/readelf.c
|
|
|
092ea1 |
@@ -1273,6 +1273,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
|
|
|
092ea1 |
uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilities */
|
|
|
092ea1 |
char name[50];
|
|
|
092ea1 |
ssize_t namesize;
|
|
|
092ea1 |
+ if (ms->flags & MAGIC_MIME)
|
|
|
092ea1 |
+ return 0;
|
|
|
092ea1 |
|
|
|
092ea1 |
if (size != xsh_sizeof) {
|
|
|
092ea1 |
if (file_printf(ms, ", corrupted section header size") == -1)
|
|
|
092ea1 |
@@ -1622,6 +1624,8 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
|
|
|
092ea1 |
break;
|
|
|
092ea1 |
|
|
|
092ea1 |
case PT_INTERP:
|
|
|
092ea1 |
+ if (ms->flags & MAGIC_MIME)
|
|
|
092ea1 |
+ continue;
|
|
|
092ea1 |
if (bufsize && nbuf[0]) {
|
|
|
092ea1 |
nbuf[bufsize - 1] = '\0';
|
|
|
092ea1 |
memcpy(interp, nbuf, bufsize);
|
|
|
092ea1 |
@@ -1629,6 +1633,8 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
|
|
|
092ea1 |
strlcpy(interp, "*empty*", sizeof(interp));
|
|
|
092ea1 |
break;
|
|
|
092ea1 |
case PT_NOTE:
|
|
|
092ea1 |
+ if (ms->flags & MAGIC_MIME)
|
|
|
092ea1 |
+ return 0;
|
|
|
092ea1 |
/*
|
|
|
092ea1 |
* This is a PT_NOTE section; loop through all the notes
|
|
|
092ea1 |
* in the section.
|
|
|
092ea1 |
@@ -1645,9 +1651,13 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
|
|
|
092ea1 |
}
|
|
|
092ea1 |
break;
|
|
|
092ea1 |
default:
|
|
|
092ea1 |
+ if (ms->flags & MAGIC_MIME)
|
|
|
092ea1 |
+ continue;
|
|
|
092ea1 |
break;
|
|
|
092ea1 |
}
|
|
|
092ea1 |
}
|
|
|
092ea1 |
+ if (ms->flags & MAGIC_MIME)
|
|
|
092ea1 |
+ return 0;
|
|
|
092ea1 |
if (file_printf(ms, ", %s linked", linking_style)
|
|
|
092ea1 |
== -1)
|
|
|
092ea1 |
return -1;
|
|
|
092ea1 |
@@ -1678,7 +1688,7 @@ file_tryelf(struct magic_set *ms, const struct buffer *b)
|
|
|
092ea1 |
Elf64_Ehdr elf64hdr;
|
|
|
092ea1 |
uint16_t type, phnum, shnum, notecount;
|
|
|
092ea1 |
|
|
|
092ea1 |
- if (ms->flags & (MAGIC_MIME|MAGIC_APPLE|MAGIC_EXTENSION))
|
|
|
092ea1 |
+ if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
|
|
|
092ea1 |
return 0;
|
|
|
092ea1 |
/*
|
|
|
092ea1 |
* ELF executables have multiple section headers in arbitrary
|
|
|
092ea1 |
--
|
|
|
092ea1 |
2.39.1
|
|
|
092ea1 |
|