summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2020-06-07 22:12:54 +0000
committerChristos Zoulas <christos@zoulas.com>2020-06-07 22:12:54 +0000
commitb674ab90d75224828d3108eefc6e3275dca7baf8 (patch)
tree82bbe5aed62e85bbe5c261cb6f48e75a82d00eaf
parentf9b78a2fcf6988f43838806e76800550f1d0d748 (diff)
downloadfile-git-b674ab90d75224828d3108eefc6e3275dca7baf8.tar.gz
Abort quickly if mime and don't print too many messages
-rw-r--r--src/readelf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/readelf.c b/src/readelf.c
index f37a6adf..cf1dc91b 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.172 2020/06/07 20:33:17 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.173 2020/06/07 22:12:54 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -67,6 +67,8 @@ private uint64_t getu64(int, uint64_t);
private int
toomany(struct magic_set *ms, const char *name, uint16_t num)
{
+ if (ms->flags & MAGIC_MIME)
+ return 1;
if (file_printf(ms, ", too many %s (%u)", name, num) == -1)
return -1;
return 1;
@@ -355,6 +357,9 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
off_t ph_off = off;
int ph_num = num;
+ if (ms->flags & MAGIC_MIME)
+ return 0;
+
if (num == 0) {
if (file_printf(ms, ", no program header") == -1)
return -1;