summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 09:28:29 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 09:28:29 +0200
commitb433026f2803b42904937059cc62d902f2ca6294 (patch)
tree6d29b99c856ccf4443f3fb2c9bb40a9695fa4b4c /apt-pkg
parented6ba81db1b2832089ea443cf0030ab3f15fda97 (diff)
parentae6ea526d65eb560b825677e8aac4a3fa15934e4 (diff)
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/deblistparser.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 651fa2a81..73628c741 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -784,7 +784,9 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
size_t len = 0;
// Skip empty lines
- for (; buffer[len] == '\r' && buffer[len] == '\n'; ++len);
+ for (; buffer[len] == '\r' && buffer[len] == '\n'; ++len)
+ /* nothing */
+ ;
if (buffer[len] == '\0')
continue;
@@ -798,13 +800,25 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
}
// seperate the tag from the data
- for (; buffer[len] != ':' && buffer[len] != '\0'; ++len);
+ for (; buffer[len] != ':' && buffer[len] != '\0'; ++len)
+ /* nothing */
+ ;
if (buffer[len] == '\0')
continue;
char* dataStart = buffer + len;
- for (++dataStart; *dataStart == ' '; ++dataStart);
+ for (++dataStart; *dataStart == ' '; ++dataStart)
+ /* nothing */
+ ;
char* dataEnd = dataStart;
- for (++dataEnd; *dataEnd != '\0'; ++dataEnd);
+ for (++dataEnd; *dataEnd != '\0'; ++dataEnd)
+ /* nothing */
+ ;
+ // The last char should be a newline, but we can never be sure: #633350
+ char* lineEnd = dataEnd;
+ for (--lineEnd; *lineEnd == '\r' || *lineEnd == '\n'; --lineEnd)
+ /* nothing */
+ ;
+ ++lineEnd;
// which datastorage need to be updated
map_ptrloc* writeTo = NULL;
@@ -819,7 +833,7 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
APT_PARSER_WRITETO(FileI->Label, "Label")
#undef APT_PARSER_WRITETO
#define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \
- pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, dataEnd-1);
+ pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, lineEnd);
APT_PARSER_FLAGIT(NotAutomatic)
APT_PARSER_FLAGIT(ButAutomaticUpgrades)
#undef APT_PARSER_FLAGIT