summaryrefslogtreecommitdiffstats
path: root/src/strip.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2011-05-30 17:23:57 +0200
committerMark Wielaard <[email protected]>2011-05-30 17:23:57 +0200
commit02a958bc2662c1c9c2d6b663742b9c8e720e25b2 (patch)
treec216136f77ea58ee6a055ad0d3ae8b59e41b820b /src/strip.c
parent3f2290ba080f91b93db882bcdeb577b34742018b (diff)
strip.c (relocate): Make offset check overflow-proof.
Diffstat (limited to 'src/strip.c')
-rw-r--r--src/strip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/strip.c b/src/strip.c
index cf6bd971..f135e7c9 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -1727,7 +1727,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
return false;
}
- if (offset + size > tdata->d_size)
+ if (offset > tdata->d_size
+ || tdata->d_size - offset < size)
error (0, 0, gettext ("bad relocation"));
/* When the symbol value is zero then for SHT_REL