refactor: Avoid unsigned integer overflow in core_write

This commit is contained in:
MarcoFalke
2022-02-11 17:26:40 +01:00
parent b79c40b057
commit fa6065661a
2 changed files with 1 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ std::string FormatScript(const CScript& script)
ret += strprintf("0x%x ", HexStr(std::vector<uint8_t>(it2, script.end())));
break;
}
return ret.substr(0, ret.size() - 1);
return ret.substr(0, ret.empty() ? ret.npos : ret.size() - 1);
}
const std::map<unsigned char, std::string> mapSigHashTypes = {