diff options
author | Michael Vogt <mvo@debian.org> | 2013-12-21 18:50:03 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-12-21 19:09:06 +0100 |
commit | 75ab11ae3880530c5354cc90c8d1ff0998f8146b (patch) | |
tree | 36a7cdb2e92eb35bc968937dc6ea34f694c9c866 /apt-pkg/tagfile.cc | |
parent | 9b7c10509c534b7d413b5102231cb0ca387f1c65 (diff) |
make /etc/apt/preferences parser deal with comment only sections
Diffstat (limited to 'apt-pkg/tagfile.cc')
-rw-r--r-- | apt-pkg/tagfile.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index e0802e3d5..bef3c76ba 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -259,7 +259,12 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength) TagCount = 0; while (TagCount+1 < sizeof(Indexes)/sizeof(Indexes[0]) && Stop < End) { - TrimRecord(true,End); + TrimRecord(true,End); + + // this can happen when TrimRecord trims away the entire Record + // (e.g. because it just contains comments) + if(Stop == End) + return true; // Start a new index and add it to the hash if (isspace(Stop[0]) == 0) @@ -273,7 +278,9 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength) if (Stop == 0) return false; - for (; Stop+1 < End && Stop[1] == '\r'; Stop++); + for (; Stop+1 < End && Stop[1] == '\r'; Stop++) + /* nothing */ + ; // Double newline marks the end of the record if (Stop+1 < End && Stop[1] == '\n') |