]> granicus.if.org Git - python/commitdiff
bpo-32681: Fix an uninitialized variable in the C implementation of os.dup2 (GH-5346)
authorStéphane Wirtel <stephane@wirtel.be>
Tue, 30 Jan 2018 06:04:36 +0000 (07:04 +0100)
committerGregory P. Smith <greg@krypto.org>
Tue, 30 Jan 2018 06:04:36 +0000 (22:04 -0800)
See https://bugs.python.org/issue32441 for where this was introduced.

Misc/NEWS.d/next/C API/2018-01-26-17-29-29.bpo-32681.N1ruWa.rst [new file with mode: 0644]
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 (file)
index 0000000..1506ec7
--- /dev/null
@@ -0,0 +1,2 @@
+Fix uninitialized variable 'res' in the C implementation of os.dup2. Patch
+by Stéphane Wirtel
index 46f3adaf4dc32067f5cbee06d65a8e25cfb975a7..4a1c9f398a07b76d1661c8add8f1ad0178f4f12b 100644 (file)
@@ -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 */