summaryrefslogtreecommitdiff
path: root/bfd/libbfd.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-07-26 12:34:43 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-07-26 12:34:43 +0000
commit64ce13c75dd0e4f9deea0f5fc9466d73cb06ffcf (patch)
treebbe22cb6fff49f6ffe969b411d29a17df1f4661b /bfd/libbfd.c
parent820e488d729b201b7cc548c8f2277b363dc4e4b0 (diff)
downloadbinutils-redhat-64ce13c75dd0e4f9deea0f5fc9466d73cb06ffcf.tar.gz
* srec.c (srec_get_section_contents): Return immediately on
count zero. Check that offset and count are within section. * libbfd.c (_bfd_generic_get_section_contents): Check that offset + count does not overflow.
Diffstat (limited to 'bfd/libbfd.c')
-rw-r--r--bfd/libbfd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 33d9c017ab..bf49a2e1db 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -820,7 +820,8 @@ _bfd_generic_get_section_contents (bfd *abfd,
return TRUE;
sz = section->rawsize ? section->rawsize : section->size;
- if (offset + count > sz)
+ if (offset + count < count
+ || offset + count > sz)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;