Permalink
Browse files

Fix segfault when invalid command issued.

First check if we actually find an entry inside the action map before
working on it further.
  • Loading branch information...
1 parent b08fafb commit 5ae68eb643bb3e8e8735cb3f5628ec32771bb97e @vodik vodik committed with Nov 5, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 ponymix.cc
View
3 ponymix.cc
@@ -456,6 +456,9 @@ static const std::pair<const string, const Command>& string_to_command(
};
const auto match = actionmap.lower_bound(str);
+ if (match == actionmap.end()) {
+ errx(1, "error: Invalid action specified: %s", str);
+ }
// Check for exact match
if (match->first == str) {

0 comments on commit 5ae68eb

Please sign in to comment.