summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:58:56 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:58:56 +0000
commitfe06d72cb3a26eba89d897098a3d22c9a9d11179 (patch)
treef0fda2acf3714fd11b1f85f05464853dc8628384
parent2d425135df32b7700762d65e0316351537e94c63 (diff)
Fix tag file parser underrun #139328
Author: jgg Date: 2002-03-26 07:22:31 GMT Fix tag file parser underrun #139328
-rw-r--r--apt-pkg/tagfile.cc42
-rw-r--r--debian/changelog4
2 files changed, 17 insertions, 29 deletions
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 45913877d..ab3647fd8 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.cc,v 1.31 2001/10/04 05:13:23 jgg Exp $
+// $Id: tagfile.cc,v 1.32 2002/03/26 07:22:31 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -68,13 +68,13 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
return false;
if (Tag.Scan(Start,End - Start) == false)
- return _error->Error(_("Unable to parse package file %s (1)"),Fd.Name().c_str());
+ return _error->Error(_("Unable to parse package file %s (1)"),
+ Fd.Name().c_str());
}
Start += Tag.size();
iOffset += Tag.size();
Tag.Trim();
-
return true;
}
/*}}}*/
@@ -90,6 +90,17 @@ bool pkgTagFile::Fill()
Start = Buffer;
End = Buffer + EndSize;
+ if (Done == false)
+ {
+ // See if only a bit of the file is left
+ unsigned long Actual;
+ if (Fd.Read(End,Size - (End - Buffer),&Actual) == false)
+ return false;
+ if (Actual != Size - (End - Buffer))
+ Done = true;
+ End += Actual;
+ }
+
if (Done == true)
{
if (EndSize <= 3)
@@ -108,31 +119,6 @@ bool pkgTagFile::Fill()
return true;
}
- // See if only a bit of the file is left
- unsigned long Actual;
- if (Fd.Read(End,Size - (End - Buffer),&Actual) == false)
- return false;
- if (Actual != Size - (End - Buffer))
- Done = true;
- End += Actual;
-/*
- if (Left < Size - (End - Buffer))
- {
- if (Fd.Read(End,Left) == false)
- return false;
-
- End += Left;
- Left = 0;
- }
- else
- {
- if (Fd.Read(End,Size - (End - Buffer)) == false)
- return false;
-
- Left -= Size - (End - Buffer);
- End = Buffer + Size;
- }*/
-
return true;
}
/*}}}*/
diff --git a/debian/changelog b/debian/changelog
index b54c39b05..fd8f13bcc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,7 +18,9 @@ apt (0.5.5) unstable; urgency=low
is to work. Closes: #133943
* Typos, Doc Stuff. Closes: #132772, #129970, #123642, #114892, #113786,
#109591, #105920, #103678
-
+ * Fix possibility for tag file parsing to fail in some unlikely situations.
+ Closes: #139328
+
-- Randolph Chung <tausq@debian.org> Tue, 4 Dec 2001 23:26:42 -0800
apt (0.5.4) unstable; urgency=low