Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-111178: Fix getsockaddrarg() undefined behavior#131668

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 12 commits intopython:mainfromvstinner:ubsan_test_socket2
Apr 1, 2025
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Remove outdated comments
  • Loading branch information
@vstinner
vstinner committedApr 1, 2025
commit94f7b6f826b473999b59e529175a0c26ad46e9bf
4 changes: 2 additions & 2 deletionsModules/socketmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2132,7 +2132,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
}
strncpy(_BT_HCI_MEMB(addr, node), straddr,
sizeof(_BT_HCI_MEMB(addr, node)));
#else /* __NetBSD__ || __DragonFly__ */
#else
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
unsigned short dev = _BT_HCI_MEMB(addr, dev);

Choose a reason for hiding this comment

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

Where is it defined?

Copy link
Member

@picnixzpicnixzApr 1, 2025
edited
Loading

Choose a reason for hiding this comment

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

There's a bunch ofdefine at the top of the file:

#if (defined(HAVE_BLUETOOTH_H)|| defined(HAVE_BLUETOOTH_BLUETOOTH_H)) \&& !defined(__NetBSD__)&& !defined(__DragonFly__)#defineUSE_BLUETOOTH 1#if defined(__FreeBSD__)...#define_BT_HCI_MEMB(sa,memb) ((sa)->hci_##memb)...#elif defined(__NetBSD__)|| defined(__DragonFly__)// <- unreachable...#define_BT_HCI_MEMB(sa,memb) ((sa)->bt_##memb)#else...#define_BT_HCI_MEMB(sa,memb) ((sa)->hci_##memb)...#endif#endif

But AFAICT, theelif defined(__NetBSD__) || defined(__DragonFly__) is not possible at all since we're still in the big#if where we want!defined(__NetBSD__) && !defined(__DragonFly__). So indeed, it looks like the macro wouldn't be defined here.

I think we should remove!defined(__NetBSD__) && !defined(__DragonFly__)

Choose a reason for hiding this comment

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

I know about_BT_HCI_MEMB. I asked on what platform the*_dev member is defined, what its name and the structure name. Its turned out that it ishci_node on FreeBSD and NetBSD.hci_dev should exist on Linux.

if (!PyArg_ParseTuple(args, "H", &dev)) {
Expand All@@ -2141,7 +2141,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
return 0;
}
_BT_HCI_MEMB(addr, dev) = dev;
#endif /* !(__NetBSD__ || __DragonFly__) */
#endif
*len_ret = sizeof *addr;
return 1;
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp