From: Julian Andres Klode Date: Wed, 20 Jul 2011 14:38:40 +0000 (+0200) Subject: * apt-pkg/pkgcache.cc: X-Git-Tag: 0.9.0~80 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/7d79339f811aeebacb3f841bac6075fdfbadd03f?ds=inline;hp=--cc * apt-pkg/pkgcache.cc: - Check that cache is at least CacheFileSize bytes large (LP: #16467) --- 7d79339f811aeebacb3f841bac6075fdfbadd03f 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) diff --git a/debian/changelog b/debian/changelog index 0a161bce7..17840ea75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ apt (0.8.16~exp4) UNRELEASED; urgency=low - [ABI break] Add pkgCache::Header::CacheFileSize, storing the cache size * apt-pkg/pkgcachegen.cc: - Write the file size to the cache + * apt-pkg/pkgcache.cc: + - Check that cache is at least CacheFileSize bytes large (LP: #16467) -- Julian Andres Klode Wed, 20 Jul 2011 16:23:55 +0200