Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: bitcoin-cli: Check length of peer.transport_protocol_type #29657

Merged
merged 1 commit into from Apr 22, 2024

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Mar 15, 2024

"v" would dereference beyond the string length, and "v10" would show as '1'

Turn both of these cases into a blank, like anything else unexpected currently is.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 15, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK sipa, hernanmarino, alfonsoromanz, achow101

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@maflcko
Copy link
Member

maflcko commented Mar 15, 2024

I don't think supporting a malicious server reply in bitcoin-cli is a use case to support. I think just using .at(1) would be fine as well, presumably resulting in a non-UB crash, similar to when the server replies with the wrong type?

@luke-jr
Copy link
Member Author

luke-jr commented Mar 17, 2024

Maybe, but this seems cleaner anyway since it also addresses far-future "v10" or such. Any reason to prefer an exception over this?

@sipa
Copy link
Member

sipa commented Mar 17, 2024

utACK c3e632b.

I wouldn't call it a bugfix, but it does seem slightly better.

@hernanmarino
Copy link
Contributor

utACK c3e632b

@alfonsoromanz
Copy link
Contributor

ACK c3e632b

1 similar comment
@achow101
Copy link
Member

ACK c3e632b

@achow101 achow101 merged commit dec74c0 into bitcoin:master Apr 22, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants