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

Fix memory bug when obtaining a port number #518

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Conversation

erlingrj
Copy link
Collaborator

The problem here was that the port number is an int32, it was initialized to -1. Then its address was casted to an uint16_t * and then written to from the create_server function. However, when a port number was obtained and written, it would only overwrite two of the four bytes. So you were left with the sign bit (set when initialized to -1)

Copy link
Contributor

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

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

Wow, good catch! Let's merge this ASAP.

@erlingrj erlingrj added this pull request to the merge queue Feb 11, 2025
Merged via the queue into main with commit 141dee7 Feb 11, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants