All the loops which might go out of control, due to excessive shdrs, have been decorated with elf_iter_ok. So there is no need for this explicit (and rather crude) check.
(Anyway, the count was a 16-bit field, so the check was redundant.) Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com> --- xen/common/libelf/libelf-tools.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/xen/common/libelf/libelf-tools.c b/xen/common/libelf/libelf-tools.c index 7fa5963..b799b56 100644 --- a/xen/common/libelf/libelf-tools.c +++ b/xen/common/libelf/libelf-tools.c @@ -131,17 +131,7 @@ uint64_t elf_round_up(struct elf_binary *elf, uint64_t addr) unsigned elf_shdr_count(struct elf_binary *elf) { - unsigned count = elf_uval(elf, elf->ehdr, e_shnum); - uint64_t max = elf->size / sizeof(Elf32_Shdr); - - if ( max > UINT_MAX ) - max = UINT_MAX; - if ( count > max ) - { - elf_mark_broken(elf, "far too many section headers"); - count = max; - } - return count; + return elf_uval(elf, elf->ehdr, e_shnum); } unsigned elf_phdr_count(struct elf_binary *elf) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel