summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-12-19 07:03:38 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-12-19 07:03:38 +0100
commit7a1bde37416835c72f0a5ffdd855c32e226dd750 (patch)
tree0e0d6fc0087e4591bda7893afebd7afc3e1183f8
parent31944ce520cb1667781dd040589d527a898e0eff (diff)
downloadelfutils-7a1bde37416835c72f0a5ffdd855c32e226dd750.tar.gz
Clean up the fix.
-rw-r--r--libelf/elf_getdata_rawchunk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c
index 0932f973..b1e17a5d 100644
--- a/libelf/elf_getdata_rawchunk.c
+++ b/libelf/elf_getdata_rawchunk.c
@@ -78,9 +78,9 @@ elf_getdata_rawchunk (elf, offset, size, type)
return NULL;
}
- if (unlikely (elf->maximum_size != ~((size_t) 0)
- && (size > elf->maximum_size
- || (off64_t) (elf->maximum_size - size) < offset)))
+ if (unlikely (offset < 0 || offset + (off64_t) size < offset
+ || (elf->maximum_size != ~((size_t) 0)
+ && offset + size > elf->maximum_size)))
{
/* Invalid request. */
__libelf_seterrno (ELF_E_INVALID_OP);