diff --git a/plugins/libimhex/include/hex/helpers/utils.hpp b/plugins/libimhex/include/hex/helpers/utils.hpp index 7226cc013..12c43a759 100644 --- a/plugins/libimhex/include/hex/helpers/utils.hpp +++ b/plugins/libimhex/include/hex/helpers/utils.hpp @@ -116,7 +116,9 @@ namespace hex { return ""; std::vector buffer(size + 1, 0x00); - snprintf(buffer.data(), size + 1, format, args ...); + if (snprintf(buffer.data(), size, format, args ...) <= 0) + return ""; + return std::string(buffer.data(), buffer.data() + size); }