sstrip: fix a section length corruption bug (patch from #6847)
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 12 Mar 2010 00:35:36 +0000 (00:35 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 12 Mar 2010 00:35:36 +0000 (00:35 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20154 3c298f89-4303-0410-b956-a3cf2f4a3e73

tools/sstrip/src/sstrip.c

index 6607d12..0508aaa 100644 (file)
@@ -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)); \
                } \
        } \
  \
This page took 0.025419 seconds and 4 git commands to generate.