]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-extracttemplates.cc
debian/apt.postinst: chown _apt:root /etc/apt/auth.conf
[apt.git] / cmdline / apt-extracttemplates.cc
index 6dd53b78dea2a81d3f0c091014c687ebe10cf81b..f95b9e5ba2eff3ec8943127a60f317541cec89d1 100644 (file)
@@ -103,10 +103,12 @@ bool DebFile::DoItem(Item &I, int &Fd)
        if (strcmp(I.Name, "control") == 0)
        {
                delete [] Control;
        if (strcmp(I.Name, "control") == 0)
        {
                delete [] Control;
-               Control = new char[I.Size+1];
-               Control[I.Size] = 0;
+               Control = new char[I.Size+3];
+               Control[I.Size] = '\n';
+               Control[I.Size + 1] = '\n';
+               Control[I.Size + 2] = '\0';
                Which = IsControl;
                Which = IsControl;
-               ControlLen = I.Size;
+               ControlLen = I.Size + 3;
                // make it call the Process method below. this is so evil
                Fd = -2;
        }
                // make it call the Process method below. this is so evil
                Fd = -2;
        }
@@ -138,7 +140,7 @@ bool DebFile::DoItem(Item &I, int &Fd)
 // ---------------------------------------------------------------------
 /* */
 bool DebFile::Process(Item &/*I*/, const unsigned char *data,
 // ---------------------------------------------------------------------
 /* */
 bool DebFile::Process(Item &/*I*/, const unsigned char *data,
-               unsigned long size, unsigned long pos)
+               unsigned long long size, unsigned long long pos)
 {
        switch (Which)
        {
 {
        switch (Which)
        {
@@ -162,9 +164,10 @@ bool DebFile::Process(Item &/*I*/, const unsigned char *data,
 bool DebFile::ParseInfo()
 {
        if (Control == NULL) return false;
 bool DebFile::ParseInfo()
 {
        if (Control == NULL) return false;
-       
+
        pkgTagSection Section;
        pkgTagSection Section;
-       Section.Scan(Control, ControlLen);
+       if (Section.Scan(Control, ControlLen) == false)
+               return false;
 
        Package = Section.FindS("Package");
        Version = GetInstalledVer(Package);
 
        Package = Section.FindS("Package");
        Version = GetInstalledVer(Package);