Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check for exact match before matching on a prefix

  • Loading branch information...
commit af38a7762b23a950618801ca8d8bbfec87bb02a7 1 parent 6903b49
@falconindy authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 ponymix.cc
View
8 ponymix.cc
@@ -449,8 +449,14 @@ static const std::pair<const string, const Command>& string_to_command(
};
const auto match = actionmap.lower_bound(str);
+
+ // Check for exact match
+ if (match->first == str) {
+ return *match;
+ }
+
+ // Match on prefix, ensure only a single match
for (auto iter = match; iter != actionmap.end(); iter++) {
- // Match on prefix, ensure only a single match
if (iter->first.find(str) != 0) {
if (iter == match) {
errx(1, "error: Invalid action specified: %s", str);
Please sign in to comment.
Something went wrong with that request. Please try again.