summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-08-08 15:25:43 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-08-08 15:25:43 +0200
commit29bc06137f829d51608fe697f3e27125d883fcef (patch)
tree7121486de1ce74a3e979f3dc0d6bc60b8a59dfe7 /apt-pkg/pkgcache.cc
parentf96bcef72c47ab32f4742da2673a12b3a47d8367 (diff)
parenta1e9379a86f199817d275b2d28d1a6b61039fcaa (diff)
merged from ubuntu-plus-debian-experimental
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 38e4e904e..2b8cb6b86 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -84,6 +84,8 @@ pkgCache::Header::Header()
memset(PkgHashTable,0,sizeof(PkgHashTable));
memset(GrpHashTable,0,sizeof(GrpHashTable));
memset(Pools,0,sizeof(Pools));
+
+ CacheFileSize = 0;
}
/*}}}*/
// Cache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/
@@ -155,6 +157,9 @@ bool pkgCache::ReMap(bool const &Errorchecks)
HeaderP->CheckSizes(DefHeader) == false)
return _error->Error(_("The package cache file is an incompatible version"));
+ if (Map.Size() < HeaderP->CacheFileSize)
+ return _error->Error(_("The package cache file is corrupted, it is too small"));
+
// Locate our VS..
if (HeaderP->VerSysName == 0 ||
(VS = pkgVersioningSystem::GetVS(StrP + HeaderP->VerSysName)) == 0)
@@ -749,9 +754,6 @@ bool pkgCache::VerIterator::Automatic() const
return false;
}
/*}}}*/
-// VerIterator::Pseudo - deprecated no-op method /*{{{*/
-bool pkgCache::VerIterator::Pseudo() const { return false; }
- /*}}}*/
// VerIterator::NewestFile - Return the newest file version relation /*{{{*/
// ---------------------------------------------------------------------
/* This looks at the version numbers associated with all of the sources