Selaa lähdekoodia

sstrip: fix a section length corruption bug (patch from #6847)

SVN-Revision: 20154
Felix Fietkau 16 vuotta sitten
vanhempi
sitoutus
b321fe82d3
1 muutettua tiedostoa jossa 1 lisäystä ja 2 poistoa
  1. 1 2
      tools/sstrip/src/sstrip.c

+ 1 - 2
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)); \
 		} \
 	} \
  \