Added more sanity checks

This commit is contained in:
sech1
2025-09-09 16:46:57 +02:00
parent bdd34c5f56
commit 0ae2af0bb8

View File

@@ -338,6 +338,11 @@ static std::vector<uint8_t> construct_monero_block_blob(rapidjson::Value* value)
auto arr = outputs->value.GetArray();
if (arr.Empty()) {
LOGWARN(3, "construct_monero_block_blob: outputs array is empty");
return empty_blob;
}
writeVarint(arr.Size(), blob);
for (rapidjson::Value* i = arr.begin(); i != arr.end(); ++i) {
@@ -385,7 +390,7 @@ static std::vector<uint8_t> construct_monero_block_blob(rapidjson::Value* value)
}
std::vector<uint8_t> t;
if (!from_hex(extra.c_str(), extra.length(), t) || t.empty()) {
if (!from_hex(extra.c_str(), extra.length(), t) || (t.size() < HASH_SIZE + 1)) {
LOGWARN(3, "construct_monero_block_blob: invalid extra " << extra);
return empty_blob;
}