Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:getsockaddrargCopy head branch name to clipboard
Oct 10, 2019
Merged

bpo-38282: Rewrite getsockaddrarg() helper function#16698
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:getsockaddrargCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented Oct 10, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

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

@vstinner

Copy link
Copy Markdown
Member Author

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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. A bit cleaner too.

@vstinner

Copy link
Copy Markdown
Member Author

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 October 10, 2019 19:30
@miss-islington

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@vstinner

Copy link
Copy Markdown
Member Author

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.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.