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

os.putenv() on Windows truncates value on an embedded NUL #111841

Closed
Labels
3.11only security fixes3.12only security fixes3.13bugs and security fixesOS-windowstype-bugAn unexpected behavior, bug, or error
@serhiy-storchaka

Description

@serhiy-storchaka

os.putenv() on Windows truncates a value containing an embedded null character.

>>>import os>>> os.putenv('xyz','abc\0def')>>> os.system('''python.bat -c "import os; print(repr(os.environ['xyz']))"''')Running Debug|x64 interpreter...'abc'0

os.putenv() andos.unsetenv() also truncate a name. It leads to OSError because it truncates before "=".

>>> os.putenv('abc\0def','xyz')Traceback (most recent call last):  File "<stdin>", line 1, in <module>    os.putenv('abc\0def', 'xyz')OSError: [Errno 22] Invalid argument>>> os.unsetenv('abc\0def')Traceback (most recent call last):  File "<stdin>", line 1, in <module>    os.unsetenv('abc\0def')OSError: [Errno 22] Invalid argument

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixesOS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp