summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheset.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-04-28 12:50:47 +0200
committerMichael Vogt <mvo@debian.org>2014-04-28 12:50:47 +0200
commit77efe478cc59fe205c35036bae8c0d5e0e6913d7 (patch)
tree292ddf183b3f38c299bd6614fbd48585aa6d00b2 /apt-pkg/cacheset.cc
parent814e1b8d623cb1e6b03c79fcdab6b20754c57038 (diff)
parent038e721ad2557fd517eae4b102cd36080f4ee6e3 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: po/vi.po
Diffstat (limited to 'apt-pkg/cacheset.cc')
-rw-r--r--apt-pkg/cacheset.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index d453a2bfb..2ed6a96da 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -391,6 +391,8 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
CacheSetHelper &helper) {
Version select = NEWEST;
std::string str = cmdline;
+ if (unlikely(str.empty() == true))
+ return false;
bool modifierPresent = false;
unsigned short fallback = modID;
for (std::list<Modifier>::const_iterator mod = mods.begin();
@@ -400,8 +402,8 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
size_t const alength = strlen(mod->Alias);
switch(mod->Pos) {
case Modifier::POSTFIX:
- if (str.compare(str.length() - alength, alength,
- mod->Alias, 0, alength) != 0)
+ if (str.length() <= alength ||
+ str.compare(str.length() - alength, alength, mod->Alias, 0, alength) != 0)
continue;
str.erase(str.length() - alength);
modID = mod->ID;