]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcache.cc
merge with debian/sid
[apt.git] / apt-pkg / pkgcache.cc
index 6db025bd06fc312ab58739d288c5edeadc9e86f2..0896482718ded11540ea3f33cb8ea53fad41d562 100644 (file)
@@ -20,6 +20,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/macros.h>
 
-#include <apti18n.h>
-    
 #include <string>
 #include <sys/stat.h>
 #include <unistd.h>
-
 #include <ctype.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using std::string;
@@ -84,6 +85,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 +158,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 +755,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