diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-07-19 08:52:21 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-07-24 17:40:13 +0200 |
commit | fa9077724507faad207f29509a8202fc6ac9d502 (patch) | |
tree | 43e949536159ec40cc2dac73d87d90326cc5feec /src | |
parent | fab6ddbee64e50d5e2f499aebca35b5911896ec4 (diff) |
rest: Reject truncated hex txid early in getutxos parsing
Diffstat (limited to 'src')
-rw-r--r-- | src/rest.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rest.cpp b/src/rest.cpp index 3cf6ad343c..80e6b52938 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -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) |