Skip to content

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.

1 participant