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

bpo-38282: Rewrite getsockaddrarg() helper function #16698

Merged
merged 1 commit into from Oct 10, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Oct 10, 2019

Rewrite getsockaddrarg() helper function of socketmodule.c (_socket
module) to prevent a false alarm when compiling codde using GCC with
_FORTIFY_SOURCE=2. Pass a pointer of the sock_addr_t union, rather
than passing a pointer to a sockaddr structure.

Add "struct sockaddr_tipc tipc;" to the sock_addr_t union.

https://bugs.python.org/issue38282

Rewrite getsockaddrarg() helper function of socketmodule.c (_socket
module) to prevent a false alarm when compiling codde using GCC with
_FORTIFY_SOURCE=2. Pass a pointer of the sock_addr_t union, rather
than passing a pointer to a sockaddr structure.

Add "struct sockaddr_tipc tipc;" to the sock_addr_t union.
@vstinner
Copy link
Member Author

vstinner commented Oct 10, 2019

@nanjekyejoannah @pablogsal @pitrou @tiran: Would you mind to review this change?

@vstinner
Copy link
Member Author

vstinner commented Oct 10, 2019

I tested manually that this change fix the GCC compiler warning when using:

./configure CFLAGS="-D_FORTIFY_SOURCE=2 -O3"
make clean
make

pitrou
pitrou approved these changes Oct 10, 2019
Copy link
Member

@pitrou pitrou left a comment

LGTM. A bit cleaner too.

@vstinner
Copy link
Member Author

vstinner commented Oct 10, 2019

LGTM. A bit cleaner too.

It helps static analyzers to follow the size of the storage.

@vstinner vstinner merged commit d565fb9 into python:master Oct 10, 2019
@vstinner vstinner deleted the getsockaddrarg branch Oct 10, 2019
@miss-islington
Copy link
Contributor

miss-islington commented Oct 10, 2019

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2019
Rewrite getsockaddrarg() helper function of socketmodule.c (_socket
module) to prevent a false alarm when compiling codde using GCC with
_FORTIFY_SOURCE=2. Pass a pointer of the sock_addr_t union, rather
than passing a pointer to a sockaddr structure.

Add "struct sockaddr_tipc tipc;" to the sock_addr_t union.
(cherry picked from commit d565fb9)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-bot
Copy link

bedevere-bot commented Oct 10, 2019

GH-16706 is a backport of this pull request to the 3.8 branch.

@vstinner
Copy link
Member Author

vstinner commented Oct 10, 2019

There are failures on FreeBSD. I close the 3.8 backport.

jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
Rewrite getsockaddrarg() helper function of socketmodule.c (_socket
module) to prevent a false alarm when compiling codde using GCC with
_FORTIFY_SOURCE=2. Pass a pointer of the sock_addr_t union, rather
than passing a pointer to a sockaddr structure.

Add "struct sockaddr_tipc tipc;" to the sock_addr_t union.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants