summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-09-24 08:59:57 (GMT)
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-09-24 08:59:57 (GMT)
commitdb2ebf1f9343cd76776603a1a80900383a0548a1 (patch)
tree6d89cfcb5b70489694720c7dc2d934e09d089f1c
parentf967dff666cb50c59f8f58b4e0838d50d1e03a0c (diff)
downloadpatchelf-db2ebf1f9343cd76776603a1a80900383a0548a1.zip
patchelf-db2ebf1f9343cd76776603a1a80900383a0548a1.tar.gz
patchelf-db2ebf1f9343cd76776603a1a80900383a0548a1.tar.bz2
* Bug fix.
-rw-r--r--patchelf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/patchelf.c b/patchelf.c
index 4ecda2e..676f6fd 100644
--- a/patchelf.c
+++ b/patchelf.c
@@ -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);