summaryrefslogtreecommitdiff
path: root/cmdline/apt-extracttemplates.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-05-14 18:04:48 +0200
committerMichael Vogt <mvo@debian.org>2014-05-14 18:04:48 +0200
commite110d7bf5675f484c06b82f621ac98bedc464865 (patch)
tree70ce5da7ad75ccbaf4b30cf4809209993ba98b23 /cmdline/apt-extracttemplates.cc
parent0b58b3f8917a49d83154fd3173bca36c1d617ef0 (diff)
parent4f6d26b4d41474aa390329b7e9cb167eb70b2821 (diff)
Merge remote-tracking branch 'donkult/debian/experimental' into debian/experimental
Conflicts: apt-pkg/acquire-item.cc apt-pkg/acquire-item.h
Diffstat (limited to 'cmdline/apt-extracttemplates.cc')
-rw-r--r--cmdline/apt-extracttemplates.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index e4428e051..7be59b9f8 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -103,10 +103,12 @@ bool DebFile::DoItem(Item &I, int &Fd)
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;
- ControlLen = I.Size;
+ ControlLen = I.Size + 3;
// make it call the Process method below. this is so evil
Fd = -2;
}
@@ -162,9 +164,10 @@ bool DebFile::Process(Item &/*I*/, const unsigned char *data,
bool DebFile::ParseInfo()
{
if (Control == NULL) return false;
-
+
pkgTagSection Section;
- Section.Scan(Control, ControlLen);
+ if (Section.Scan(Control, ControlLen) == false)
+ return false;
Package = Section.FindS("Package");
Version = GetInstalledVer(Package);