From: Felix Fietkau Date: Fri, 12 Mar 2010 00:35:36 +0000 (+0000) Subject: sstrip: fix a section length corruption bug (patch from #6847) X-Git-Tag: reboot~20686 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b321fe82d325064f971a6dcda21696a4d82ba396;p=oweals%2Fopenwrt.git sstrip: fix a section length corruption bug (patch from #6847) SVN-Revision: 20154 --- diff --git a/tools/sstrip/src/sstrip.c b/tools/sstrip/src/sstrip.c index 6607d12500..0508aaac81 100644 --- a/tools/sstrip/src/sstrip.c +++ b/tools/sstrip/src/sstrip.c @@ -251,8 +251,7 @@ static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \ ESET(phdr->p_offset,newsize); \ ESET(phdr->p_filesz,0); \ } else if (EGET(phdr->p_offset) + EGET(phdr->p_filesz) > newsize) { \ - newsize -= EGET(phdr->p_offset); \ - ESET(phdr->p_filesz, newsize); \ + ESET(phdr->p_filesz, newsize - EGET(phdr->p_offset)); \ } \ } \ \