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

shm_open() and shm_unlink() truncate names with embedded null characters #115886

Closed
serhiy-storchaka opened this issue Feb 24, 2024 · 0 comments
Closed
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Feb 24, 2024

Bug report

Posix functions shm_open() and shm_unlink() take a null terminated C strings using PyUnicode_AsUTF8AndSize(path, NULL) which returns a pointer to char buffer which can include embedded null characters. When interpreted as C strings they are terminated at embedded null characters.

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes labels Feb 24, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 24, 2024
shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
serhiy-storchaka added a commit that referenced this issue Feb 25, 2024
…115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 25, 2024
…ory name (pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 25, 2024
…ory name (pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Feb 25, 2024
…me (GH-115887) (GH-115906)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)
serhiy-storchaka added a commit that referenced this issue Feb 25, 2024
…me (GH-115887) (GH-115907)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this issue Mar 4, 2024
pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
Development

No branches or pull requests

1 participant