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

cf-socket: don't try getting local IP without socket #13577

Closed
wants to merge 1 commit into from

Conversation

bagder
Copy link
Member

@bagder bagder commented May 10, 2024

In cf_tcp_connect(), it might fail and not get a socket assigned to ctx->sock but set_local_ip() is still called which would make getsockname() get invoked with a negative file desriptor and fail.

By adding this check, set_local_ip() will now instead blank out the fields correctly.

Spotted by CodeSonar

In cf_tcp_connect(), it might fail and not get a socket assigned to
ctx->sock but set_local_ip() is still called which would make
getsockname() get invoked with a negative file desriptor and fail.

By adding this check, set_local_ip() will now instead blank out the
fields correctly.

Spotted by CodeSonar
@bagder bagder requested a review from icing May 10, 2024 08:55
@bagder bagder closed this in 4d38cea May 10, 2024
@bagder bagder deleted the bagder/local-ip-bad-socket branch May 10, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant