aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Gomizelj <simongmzlj@gmail.com>2013-11-05 01:15:47 -0500
committerDave Reisner <dreisner@archlinux.org>2013-11-05 08:42:58 -0500
commit5ae68eb643bb3e8e8735cb3f5628ec32771bb97e (patch)
tree3fc0c632c871065468a01b16b398788e0757dd35
parentb08fafb51af33379457a8945fc67161761478abf (diff)
downloadmirror-ponymix-5ae68eb643bb3e8e8735cb3f5628ec32771bb97e.tar.gz
mirror-ponymix-5ae68eb643bb3e8e8735cb3f5628ec32771bb97e.tar.bz2
mirror-ponymix-5ae68eb643bb3e8e8735cb3f5628ec32771bb97e.zip
Fix segfault when invalid command issued.
First check if we actually find an entry inside the action map before working on it further.
-rw-r--r--ponymix.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/ponymix.cc b/ponymix.cc
index 5da741e..de3eebb 100644
--- a/ponymix.cc
+++ b/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) {