]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Clean up the fix.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 19 Dec 2010 06:03:38 +0000 (07:03 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 19 Dec 2010 06:03:38 +0000 (07:03 +0100)
libelf/elf_getdata_rawchunk.c

index 0932f973defcec986dfd6de4e6909690d7253b01..b1e17a5d166cb7380368c33a529aa4d78ef91bf3 100644 (file)
@@ -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);