Skip to content

assert return of mcd_rpc_message_to_iovecs #1360

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 2 commits into from
Jul 25, 2023

Conversation

kevinAlbs
Copy link
Collaborator

Summary

  • assert return value of mcd_rpc_message_to_iovecs.

Background & Motivation

Addresses Coverity issue with CID 138246: "Dereference null return value". I do not expect these calls to mcd_rpc_message_to_iovecs to possibly fail given the current implementation. The added BSON_ASSERT is consistent with other calls. If future changes to mcd_rpc_message_to_iovecs result in a condition where mcd_rpc_message_to_iovecs may return NULL, this may prevent a NULL dereference.

Current implementation is expected not to return `NULL`.
`BSON_ASSERT` is added for consistency with other calls and to future-proof.
@kevinAlbs kevinAlbs requested a review from eramongodb July 25, 2023 13:31
Copy link
Contributor

@eramongodb eramongodb left a comment

Choose a reason for hiding this comment

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

Looks like I had missed a few spots. Thank you for the fixes. LGTM!

@kevinAlbs kevinAlbs merged commit c75eaf5 into mongodb:master Jul 25, 2023
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.

2 participants