From 5ae68eb643bb3e8e8735cb3f5628ec32771bb97e Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Tue, 5 Nov 2013 01:15:47 -0500 Subject: Fix segfault when invalid command issued. First check if we actually find an entry inside the action map before working on it further. --- ponymix.cc | 3 +++ 1 file changed, 3 insertions(+) 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& 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) { -- cgit v1.2.3