mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 18:53:21 +01:00
rest: Reject truncated hex txid early in getutxos parsing
This commit is contained in:
@@ -792,13 +792,14 @@ static bool rest_getutxos(const std::any& context, HTTPRequest* req, const std::
|
||||
if (txid_out.size() != 2) {
|
||||
return RESTERR(req, HTTP_BAD_REQUEST, "Parse error");
|
||||
}
|
||||
auto txid{Txid::FromHex(txid_out.at(0))};
|
||||
auto output{ToIntegral<uint32_t>(txid_out.at(1))};
|
||||
|
||||
if (!output || !IsHex(txid_out.at(0))) {
|
||||
if (!txid || !output) {
|
||||
return RESTERR(req, HTTP_BAD_REQUEST, "Parse error");
|
||||
}
|
||||
|
||||
vOutPoints.emplace_back(TxidFromString(txid_out.at(0)), *output);
|
||||
vOutPoints.emplace_back(*txid, *output);
|
||||
}
|
||||
|
||||
if (vOutPoints.size() > 0)
|
||||
|
||||
Reference in New Issue
Block a user