From b674ab90d75224828d3108eefc6e3275dca7baf8 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sun, 7 Jun 2020 22:12:54 +0000 Subject: Abort quickly if mime and don't print too many messages --- src/readelf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1