diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-09-24 08:59:57 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-09-24 08:59:57 (GMT) |
commit | db2ebf1f9343cd76776603a1a80900383a0548a1 (patch) | |
tree | 6d89cfcb5b70489694720c7dc2d934e09d089f1c | |
parent | f967dff666cb50c59f8f58b4e0838d50d1e03a0c (diff) | |
download | patchelf-db2ebf1f9343cd76776603a1a80900383a0548a1.zip patchelf-db2ebf1f9343cd76776603a1a80900383a0548a1.tar.gz patchelf-db2ebf1f9343cd76776603a1a80900383a0548a1.tar.bz2 |
* Bug fix.
-rw-r--r-- | patchelf.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -12,7 +12,7 @@ #include <elf.h> -static off_t fileSize, maxSize = 128 * 1024; +static off_t fileSize, maxSize; static unsigned char * contents = 0; @@ -38,6 +38,7 @@ static void readFile(char * fileName) struct stat st; if (stat(fileName, &st) != 0) error("stat"); fileSize = st.st_size; + maxSize = fileSize + 128 * 1024; contents = malloc(fileSize + maxSize); if (!contents) abort(); @@ -94,7 +95,7 @@ static void patchElf(char * fileName) error("missing program header"); if (hdr->e_shoff + hdr->e_shnum * hdr->e_shentsize > fileSize) - error("missing program header"); + error("missing section header"); /* Find the PT_INTERP segment. */ Elf32_Phdr * phdr = (Elf32_Phdr *) (contents + hdr->e_phoff); |