Extra formatting check in hex::format

This commit is contained in:
WerWolv
2021-01-25 13:36:25 +01:00
parent 9ff92aeb40
commit b58bc685e1

View File

@@ -116,7 +116,9 @@ namespace hex {
return "";
std::vector<char> 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);
}