Skip to content

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

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/local-ip-bad-socket
Closed

cf-socket: don't try getting local IP without socket#13577
bagder wants to merge 1 commit into
masterfrom
bagder/local-ip-bad-socket

Conversation

@bagder

@bagder bagder commented May 10, 2024

Copy link
Copy Markdown
Member

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