From ac9ff795cdfd25c37b9b9be44f3d034bfa3284d3 Mon Sep 17 00:00:00 2001 From: bazuin-32 Date: Tue, 12 Jul 2022 15:38:50 -0600 Subject: [PATCH] Fix calls to `substr` with invalid `pos` --- src/debug/HyprCtl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 76fe3c565..684bca9c8 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -526,7 +526,8 @@ std::string getReply(std::string request) { format = HyprCtl::FORMAT_JSON; } - request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string + if (sepIndex < request.size()) + request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string if (request == "monitors") return monitorsRequest(format);