[maemo-commits] [maemo-commits] r8454 - projects/haf/trunk/apt/apt-pkg/contrib
From: www-data at stage.maemo.org www-data at stage.maemo.orgDate: Wed Nov 29 15:56:35 EET 2006
- Previous message: [maemo-commits] r8453 - projects/haf/trunk/osso-af-startup/debian
- Next message: [maemo-commits] r8455 - projects/haf/trunk/apt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll
Date: 2006-11-29 15:56:35 +0200 (Wed, 29 Nov 2006)
New Revision: 8454
Modified:
projects/haf/trunk/apt/apt-pkg/contrib/mmap.cc
Log:
* apt-pkg/contrib/mmap.cc (WriteString): Set iSize before checking
if there is still room so that IsOverfull can detect the overflow.
Also, check with the real length of the string when Len is -1.
Modified: projects/haf/trunk/apt/apt-pkg/contrib/mmap.cc
===================================================================
--- projects/haf/trunk/apt/apt-pkg/contrib/mmap.cc 2006-11-29 13:45:08 UTC (rev 8453)
+++ projects/haf/trunk/apt/apt-pkg/contrib/mmap.cc 2006-11-29 13:56:35 UTC (rev 8454)
@@ -328,16 +328,18 @@
unsigned long Len)
{
unsigned long Result = iSize;
+
+ if (Len == (unsigned long)-1)
+ Len = strlen(String);
+ iSize += Len + 1;
+
// Just in case error check
- if (Result + Len > WorkSpace)
+ if (iSize > WorkSpace)
{
_error->Error("Dynamic MMap ran out of room");
return 0;
}
- if (Len == (unsigned long)-1)
- Len = strlen(String);
- iSize += Len + 1;
memcpy((char *)Base + Result,String,Len);
((char *)Base)[Result + Len] = 0;
return Result;
- Previous message: [maemo-commits] r8453 - projects/haf/trunk/osso-af-startup/debian
- Next message: [maemo-commits] r8455 - projects/haf/trunk/apt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
