summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2010-07-13 13:10:39 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2010-07-13 13:10:39 +0200
commitc0e307b848d8de23e6f10a179c4f240c023c8b82 (patch)
treeba329337ddf6612f4c893321a0565f152bd5e2bd
parenta67a62c296103f50bff9f9e6bcfb90def2b8d62e (diff)
sstrip: fix section length corruption bug
Based on openwrt #6847: https://dev.openwrt.org/ticket/6847 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-rw-r--r--toolchain/sstrip/sstrip.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/toolchain/sstrip/sstrip.c b/toolchain/sstrip/sstrip.c
index 1842f053c..03adc0eac 100644
--- a/toolchain/sstrip/sstrip.c
+++ b/toolchain/sstrip/sstrip.c
@@ -253,8 +253,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)); \
} \
} \
\