diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-08-01 15:30:50 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-08-01 15:30:50 +0200 |
commit | f96bcef72c47ab32f4742da2673a12b3a47d8367 (patch) | |
tree | 671e533c88e15554d175c3c0c8897faf14a2415d /apt-pkg | |
parent | cfba1fd82dde4d73c8856c50e2f9c8ca57af0a56 (diff) | |
parent | 7ca05341380434ae9e557d16d1ae88d133f0490c (diff) |
merged from the debian-sid branch
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 24 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 4 |
2 files changed, 22 insertions, 6 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 diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index efd764b51..2bfb77609 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -636,7 +636,9 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) Dynamic<pkgCache::VerIterator> DynV(V); for (; V.end() != true; V++) { - char const * const Arch = P.Arch(); + // copy P.Arch() into a string here as a cache remap + // in NewDepends() later may alter the pointer location + string Arch = P.Arch() == NULL ? "" : P.Arch(); map_ptrloc *OldDepLast = NULL; /* MultiArch handling introduces a lot of implicit Dependencies: - MultiArch: same → Co-Installable if they have the same version |