summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-07-27 23:50:55 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-07-27 23:50:55 +0200
commitae6ea526d65eb560b825677e8aac4a3fa15934e4 (patch)
treeecbc02045dfc78aa9f09295f07918f9224edbdb5 /apt-pkg/deb/deblistparser.cc
parented6ba81db1b2832089ea443cf0030ab3f15fda97 (diff)
* apt-pkg/deb/deblistparser.cc:
- do not assume that the last char on a line is a \n (Closes: #633350)
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 651fa2a81..fd5a1e475 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -805,6 +805,10 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
for (++dataStart; *dataStart == ' '; ++dataStart);
char* dataEnd = dataStart;
for (++dataEnd; *dataEnd != '\0'; ++dataEnd);
+ // The last char should be a newline, but we can never be sure: #633350
+ char* lineEnd = dataEnd;
+ for (--lineEnd; *lineEnd == '\r' || *lineEnd == '\n'; --lineEnd);
+ ++lineEnd;
// which datastorage need to be updated
map_ptrloc* writeTo = NULL;
@@ -819,7 +823,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