Bound the results-exchange JSON_read to reject an oversized length - #2073
Open
pau-hedgehog wants to merge 1 commit into
Open
pau-hedgehog wants to merge 1 commit into
pau-hedgehog wants to merge 1 commit into
Conversation
get_results() passed 0 as max_size to JSON_read(), disabling its bounds check on the final results-exchange read. A misread SERVER_ERROR control byte could then decode as a ~4 GB length and turn a server-side abort into a misleading client-side ENOMEM instead of the real error. Add MAX_RESULTS_JSON_STRING (64 MiB) and use it here, matching the treatment the params-read call already gets a few hundred lines earlier in the same file. Fixes esnet#2072 Signed-off-by: Pau Capdevila <pau@githedgehog.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PLEASE NOTE the following text from the iperf3 license. Submitting a
pull request to the iperf3 repository constitutes "[making]
Enhancements available...publicly":
The complete iperf3 license is available in the
LICENSEfile in thetop directory of the iperf3 source tree.
Version of iperf3 (or development branch, such as
masteror3.1-STABLE) to which this pull request applies: masterIssues fixed (if any): Fixes get_results() passes 0 as max_size to JSON_read(), so a misread control-channel byte can trigger a multi-GB allocation instead of a clean error #2072
Brief description of code changes (suitable for use as a commit message):
get_results() passed 0 as max_size to JSON_read(), disabling its bounds check on the results-exchange read. This adds a new MAX_RESULTS_JSON_STRING bound (64 MiB, generous enough for --get-server-output on a long, many-stream test) and uses it in that call, matching the treatment the params-read call already gets from MAX_PARAMS_JSON_STRING a few hundred lines earlier in the same file.
Tested locally: built and ran
make check(all 5 unit tests pass), then ran a real client/server pair with the patched binary covering bidir multi-stream transfer and --get-server-output, confirming get_results() still parses legitimate results correctly under the new bound.