summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-09-02 15:19:51 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-09-02 15:19:51 +0200
commit99aa69c74f27a70d585510b817561fbf20ac7fb5 (patch)
tree0f340000f4f91953d95a7eafa33479ed58851f95
parent3cbbda3c5af73f73b2d32b34078c4e6b9fef8a6e (diff)
check for length of Data to avoid the validness of
Pin: origin " (no error displayed). We already know in this method that Data is at least one char long, so we avoid the length counting as long as the string doesn't start with "
-rw-r--r--apt-pkg/versionmatch.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc
index 17a54bc4c..c40b1fdbc 100644
--- a/apt-pkg/versionmatch.cc
+++ b/apt-pkg/versionmatch.cc
@@ -118,7 +118,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
if (Type == Origin)
{
- if (Data[0] == '"' && Data.end()[-1] == '"')
+ if (Data[0] == '"' && Data.length() >= 2 && Data.end()[-1] == '"')
OrSite = Data.substr(1, Data.length() - 2);
else
OrSite = Data;