summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2011-07-20 16:38:40 +0200
committerJulian Andres Klode <jak@debian.org>2011-07-20 16:38:40 +0200
commit7d79339f811aeebacb3f841bac6075fdfbadd03f (patch)
tree6efe06a6a2bf473a08cb788124fc8cc8376ea62d /apt-pkg/pkgcache.cc
parent1dfda2ce4ce2848a0dda314038ff08ffb81b122b (diff)
* apt-pkg/pkgcache.cc:
- Check that cache is at least CacheFileSize bytes large (LP: #16467)
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 1fd21a0ad..2b8cb6b86 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -157,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)