vstinner · GitHub

Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

Closed

picnixz

Fix also BTPROTO_RFCOMM and BTPROTO_HCI code path.

@vstinner

serhiy-storchaka

@vstinner

serhiy-storchaka

@vstinner

@vstinner

serhiy-storchaka

The socket address channel is not initialized before calling
PyArg_ParseTuple().

@vstinner

@vstinner

@vstinner

vstinner added a commit to vstinner/cpython that referenced this pull request

Apr 1, 2025
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.
On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit  8cd29c2 )

vstinner added a commit that referenced this pull request

Apr 1, 2025
…131977)
gh-111178: Fix getsockaddrarg() undefined behavior (#131668)
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.
On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit  8cd29c2 )

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Apr 1, 2025
…onGH-131668) (pythonGH-131977)
pythongh-111178: Fix getsockaddrarg() undefined behavior (pythonGH-131668)
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.
On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit  c318a03 )
Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit  8cd29c2 )

Merged

Closed

vstinner added a commit that referenced this pull request

Apr 1, 2025
…GH-131977) (#131979)
[3.13] gh-111178: Fix getsockaddrarg() undefined behavior (GH-131668) (GH-131977)
gh-111178: Fix getsockaddrarg() undefined behavior (GH-131668)
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.
On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit  c318a03 )
Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit  8cd29c2 )
Co-authored-by: Victor Stinner <vstinner@python.org>

Closed

This was referenced

Apr 4, 2025

Closed

Merged

Read the original on github.com ↗