summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debmetaindex.cc
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2019-04-11 13:31:14 -1000
committerSam Bingner <sam@bingner.com>2019-04-12 11:09:50 -1000
commit706e8fe6cb93323e6b03c662aaced03a36db3574 (patch)
treea1c41e96b4b5d5f0f19e1b71cd0c80390ecae760 /apt-pkg/deb/debmetaindex.cc
parentff4a8039b2e1a4ff53f1114266b9bec24b174f81 (diff)
Don't access invalid string indexes
Diffstat (limited to 'apt-pkg/deb/debmetaindex.cc')
-rw-r--r--apt-pkg/deb/debmetaindex.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index f25906fba..610965024 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -682,13 +682,13 @@ bool debReleaseIndex::SetSignedBy(std::string const &pSignedBy)
SignedBy = os.str();
}
// Normalize the string: Remove trailing commas
- while (SignedBy[SignedBy.size() - 1] == ',')
+ while (SignedBy.size() > 0 && SignedBy[SignedBy.size() - 1] == ',')
SignedBy.resize(SignedBy.size() - 1);
}
else {
// Only compare normalized strings
auto pSignedByView = APT::StringView(pSignedBy);
- while (pSignedByView[pSignedByView.size() - 1] == ',')
+ while (pSignedByView.size() > 0 && pSignedByView[pSignedByView.size() - 1] == ',')
pSignedByView = pSignedByView.substr(0, pSignedByView.size() - 1);
if (pSignedByView != SignedBy)
return _error->Error(_("Conflicting values set for option %s regarding source %s %s: %s != %s"), "Signed-By", URI.c_str(), Dist.c_str(), SignedBy.c_str(), pSignedByView.to_string().c_str());