|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 6/8] libelf: loop safety cleanup: Remove obsolete check in elf_shdr_count
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.Jackson@xxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |