From 470773ca75ff6883599e9439c703f3aec43b616c Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:54:20 +0000 Subject: Small range check bug Author: jgg Date: 1999-07-18 05:58:40 GMT Small range check bug --- apt-pkg/contrib/mmap.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 098c61ca6..850e1046a 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: mmap.cc,v 1.15 1999/04/18 06:36:36 jgg Exp $ +// $Id: mmap.cc,v 1.16 1999/07/18 05:58:40 jgg Exp $ /* ###################################################################### MMap Class - Provides 'real' mmap or a faked mmap using read(). @@ -206,6 +206,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln) _error->Error("Dynamic MMap ran out of room"); return 0; } + return Result; } /*}}}*/ @@ -250,7 +251,7 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize) I->Count--; unsigned long Result = I->Start; - I->Start += ItemSize; + I->Start += ItemSize; return Result/ItemSize; } /*}}}*/ @@ -262,7 +263,7 @@ unsigned long DynamicMMap::WriteString(const char *String, { unsigned long Result = iSize; // Just in case error check - if (Result > WorkSpace) + if (Result + Len > WorkSpace) { _error->Error("Dynamic MMap ran out of room"); return 0; -- cgit v1.2.3-70-g09d2