[Python-checkins] bpo-32681: Fix an uninitialized variable in the C implementation of os.dup2 (GH-5346)

Gregory P. Smith webhook-mailer at python.org
Tue Jan 30 01:04:39 EST 2018


https://github.com/python/cpython/commit/3d86e484de6334fe16cbab512744597bd0de4e80
commit: 3d86e484de6334fe16cbab512744597bd0de4e80
branch: master
author: Stéphane Wirtel <stephane at wirtel.be>
committer: Gregory P. Smith <greg at krypto.org>
date: 2018-01-29T22:04:36-08:00
summary:

bpo-32681: Fix an uninitialized variable in the C implementation of os.dup2 (GH-5346)

See https://bugs.python.org/issue32441 for where this was introduced.

files:
A Misc/NEWS.d/next/C API/2018-01-26-17-29-29.bpo-32681.N1ruWa.rst
M Modules/posixmodule.c

diff --git a/Misc/NEWS.d/next/C API/2018-01-26-17-29-29.bpo-32681.N1ruWa.rst b/Misc/NEWS.d/next/C API/2018-01-26-17-29-29.bpo-32681.N1ruWa.rst
new file mode 100644
index 000000000000..1506ec797c4b
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2018-01-26-17-29-29.bpo-32681.N1ruWa.rst	
@@ -0,0 +1,2 @@
+Fix uninitialized variable 'res' in the C implementation of os.dup2. Patch
+by Stéphane Wirtel
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 46f3adaf4dc3..4a1c9f398a07 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8012,7 +8012,7 @@ static int
 os_dup2_impl(PyObject *module, int fd, int fd2, int inheritable)
 /*[clinic end generated code: output=bc059d34a73404d1 input=c3cddda8922b038d]*/
 {
-    int res;
+    int res = 0;
 #if defined(HAVE_DUP3) && \
     !(defined(HAVE_FCNTL_H) && defined(F_DUP2FD_CLOEXEC))
     /* dup3() is available on Linux 2.6.27+ and glibc 2.9 */



More information about the Python-checkins mailing list