From 7498a72f70d9e66e4edd17da6d54fc7d94f983c7 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 7 Oct 2021 21:47:39 +0200 Subject: [PATCH] patterns: Fixed null bytes being included in read strings --- plugins/libimhex/include/hex/pattern_language/ast_node.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index 79fbe2796..3479c422d 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -1421,6 +1421,7 @@ namespace hex::pl { else { value.resize(pattern->getSize()); evaluator->getProvider()->read(pattern->getOffset(), value.data(), value.size()); + value.erase(std::find(value.begin(), value.end(), '\0'), value.end()); } }; @@ -1476,6 +1477,7 @@ namespace hex::pl { else { value.resize(pattern->getSize()); evaluator->getProvider()->read(pattern->getOffset(), value.data(), value.size()); + value.erase(std::find(value.begin(), value.end(), '\0'), value.end()); } literal = value;