mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495) (GH-114502)
On Alpine Linux it could leave some field non-initialized.
(cherry picked from commit d22c066b80
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
f63dec94f6
commit
386c72d992
2 changed files with 4 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
Make the result of :func:`termios.tcgetattr` reproducible on Alpine Linux.
|
||||
Previously it could leave a random garbage in some fields.
|
|
@ -84,6 +84,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue