diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-01-23 21:27:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 21:27:04 (GMT) |
commit | d22c066b802592932f9eb18434782299e80ca42e (patch) | |
tree | 5ea5a9e563a88627497f10191ae6b450accf621b /Modules/termios.c | |
parent | ce01ab536f22a3cf095d621f3b3579c1e3567859 (diff) | |
download | cpython-d22c066b802592932f9eb18434782299e80ca42e.zip cpython-d22c066b802592932f9eb18434782299e80ca42e.tar.gz cpython-d22c066b802592932f9eb18434782299e80ca42e.tar.bz2 |
gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495)
On Alpine Linux it could leave some field non-initialized.
Diffstat (limited to 'Modules/termios.c')
-rw-r--r-- | Modules/termios.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/termios.c b/Modules/termios.c index c4f0fd9..69dbd88 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -98,6 +98,8 @@ termios_tcgetattr_impl(PyObject *module, int fd) struct termios mode; int r; + /* Alpine Linux can leave some fields uninitialized. */ + memset(&mode, 0, sizeof(mode)); Py_BEGIN_ALLOW_THREADS r = tcgetattr(fd, &mode); Py_END_ALLOW_THREADS |