Skip to content

Add assertion for the assumed tal_count(msg) >= sizeof(be16) in subdaemon_malformed_msg(...) #537

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

Merged
merged 1 commit into from
Jan 12, 2018
Merged

Add assertion for the assumed tal_count(msg) >= sizeof(be16) in subdaemon_malformed_msg(...) #537

merged 1 commit into from
Jan 12, 2018

Conversation

practicalswift
Copy link
Contributor

Add assertion for the assumed tal_count(msg) >= sizeof(be16) in subdaemon_malformed_msg(...).

An unsigned integer overflow will occur if tal_count(msg) >= sizeof(be16) does not hold true.

Explicit is better than implicit :-)

@cdecker
Copy link
Member

cdecker commented Jan 9, 2018

ACK e1e3afe

Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! But it'd be more robust to dump the message anyway when something goes wrong. We should print the whole thing (fromwire_peektype handles the case of a truncated message already).

So just change it to "tal_hex(msg, msg)".

@practicalswift
Copy link
Contributor Author

@rustyrussell Updated and pushed. Did I understand your change request correctly? :-)

@rustyrussell rustyrussell merged commit a900551 into ElementsProject:master Jan 12, 2018
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.

3 participants