diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-05-05 16:03:03 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-05-05 16:03:03 +0200 |
commit | 98c934f2723d63d00908803ad47ab1359081ec2d (patch) | |
tree | df7c21f028089b99d63289d784ee5bd23d54d380 /apt-pkg/cacheset.cc | |
parent | a298a1dc595c548e6c10b48b8e69d987e5be1c42 (diff) | |
parent | a11f6c973bc0dc226d8953e3edb6333d526c3143 (diff) |
Merge remote-tracking branch 'upstream/debian/sid' into debian/sid
Diffstat (limited to 'apt-pkg/cacheset.cc')
-rw-r--r-- | apt-pkg/cacheset.cc | 6 |
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; |