Merge bitcoin/bitcoin#27468: bugfix: rest: avoid segfault for invalid URI #1134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bitcoin Backport
Backports Bitcoin Core PR bitcoin#27468
Bitcoin Commit: e054b73
Summary
This backport fixes a segfault vulnerability in the REST interface when handling invalid URI query parameters. The fix adds proper exception handling for query parameter parsing.
Changes
GetQueryParameter()callsrest_headersandrest_filter_headerendpointsrest_mempool_contentsincluding:verboseparameter validation (true/false)mempool_sequenceparameter validation (true/false)Dash-Specific Adaptations
The Bitcoin change modified a unified
rest_mempoolfunction, but Dash has this split into two functions:rest_mempool_info: Returns basic mempool info (no query parameters needed)rest_mempool_contents: Returns detailed mempool contents (now includes query parameter validation)The error handling from Bitcoin was appropriately applied to
rest_mempool_contentswhere theverboseandmempool_sequenceparameters are relevant.Testing
Batch: 412
Version: 0.25