From 38a5522832d2ad0539002b38b2e356703a37c807 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 3 Feb 2020 16:53:26 +0100 Subject: [PATCH] Fix controller segfault when source is very short --- src/controller/controller_streams.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controller/controller_streams.cpp b/src/controller/controller_streams.cpp index 0fcd2dac..d42d02a4 100644 --- a/src/controller/controller_streams.cpp +++ b/src/controller/controller_streams.cpp @@ -385,6 +385,8 @@ namespace Controller { bool isMatch(const std::string & source, const std::string & match){ std::string front = match.substr(0,match.find('*')); std::string back = match.substr(match.find('*')+1); + //if the length of the source is smaller than the front and back matching parts together, it can never match + if (source.size() < front.size()+back.size()){return false;} return (source.substr(0,front.size()) == front && source.substr(source.size()-back.size()) == back); }