Skip to content

Commit d7cdad0

Browse files
committed
Stop reporting bad capabilities after the first few.
1 parent b4c0114 commit d7cdad0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/readelf.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "file.h"
2828

2929
#ifndef lint
30-
FILE_RCSID("@(#)$File: readelf.c,v 1.104 2014/10/17 15:49:00 christos Exp $")
30+
FILE_RCSID("@(#)$File: readelf.c,v 1.105 2014/11/22 16:04:29 christos Exp $")
3131
#endif
3232

3333
#ifdef BUILTIN_ELF
@@ -919,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
919919
Elf32_Shdr sh32;
920920
Elf64_Shdr sh64;
921921
int stripped = 1;
922+
size_t nbadcap = 0;
922923
void *nbuf;
923924
off_t noff, coff, name_off;
924925
uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */
@@ -1007,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
10071008
goto skip;
10081009
}
10091010

1011+
if (nbadcap > 5)
1012+
break;
10101013
if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
10111014
file_badseek(ms);
10121015
return -1;
@@ -1072,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
10721075
(unsigned long long)xcap_tag,
10731076
(unsigned long long)xcap_val) == -1)
10741077
return -1;
1078+
if (nbadcap++ > 2)
1079+
coff = xsh_size;
10751080
break;
10761081
}
10771082
}

0 commit comments

Comments
 (0)