From b7a5b9437a95d858259058022bcbae5c0950d388 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sat, 1 Jan 2022 14:20:18 -0800 Subject: [PATCH] Fix checking of sh_name versus shstrsec->sh_size https://github.com/upx/upx/issues/509 modified: p_vmlinx.cpp --- src/p_vmlinx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_vmlinx.cpp b/src/p_vmlinx.cpp index cc57fc4f..a78959e1 100644 --- a/src/p_vmlinx.cpp +++ b/src/p_vmlinx.cpp @@ -180,7 +180,7 @@ bool PackVmlinuxBase::canPack() int j; for (p = shdri, j= ehdri.e_shnum; --j>=0; ++p) { if (Shdr::SHT_PROGBITS==p->sh_type - && (p->sh_name + shstrsec->sh_offset) < (unsigned)file_size + && p->sh_name < shstrsec->sh_size && 0==strcmp("__ksymtab", p->sh_name + shstrtab)) { break; }