From 708e2f1fe99e6f067292bc909f03f12c181e4798 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 18 Sep 2016 13:24:35 +0200 Subject: VersionHash: Do not skip too long dependency lines If the dependency line does not contain spaces in the repository but does in the dpkg status file (because dpkg normalized the dependency list), the dpkg line might be longer than the line in the repository. If it now happens to be longer than 1024 characters, it would be skipped, causing the hashes to be out of date. Note that we have to bump the minor cache version again as this changes the format slightly, and we might get mismatches with an older src cache otherwise. Fixes Debian/apt#23 --- apt-pkg/deb/deblistparser.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/deblistparser.cc') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index f7f64debd..99e806470 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -344,14 +344,14 @@ unsigned short debListParser::VersionHash() { const char *Start; const char *End; - if (Section.Find(I,Start,End) == false || End - Start >= (signed)sizeof(S)) + if (Section.Find(I,Start,End) == false) continue; /* Strip out any spaces from the text, this undoes dpkgs reformatting of certain fields. dpkg also has the rather interesting notion of reformatting depends operators < -> <= */ char *J = S; - for (; Start != End; ++Start) + for (; Start != End && (J - S) < sizeof(S); ++Start) { if (isspace_ascii(*Start) != 0) continue; -- cgit v1.2.3