]> code.ossystems Code Review - openembedded-core.git/commitdiff
python: Fix CVE-2014-1912
authorMaxin B. John <maxin.john@enea.com>
Mon, 7 Apr 2014 15:48:11 +0000 (17:48 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 8 Apr 2014 16:51:04 +0000 (17:51 +0100)
A remote user can send specially crafted data to trigger a buffer overflow
in socket.recvfrom_into() and execute arbitrary code on the target system.
The code will run with the privileges of the target service.

This back-ported patch fixes CVE-2014-1912

Signed-off-by: Maxin B. John <maxin.john@enea.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch [new file with mode: 0644]
meta/recipes-devtools/python/python_2.7.3.bb

diff --git a/meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch
new file mode 100644 (file)
index 0000000..02cc83d
--- /dev/null
@@ -0,0 +1,26 @@
+Upstream-Status: Backport
+
+Reference: http://bugs.python.org/issue20246
+
+CVE-2014-1912: Python buffer overflow in socket.recvfrom_into()
+lets remote users execute arbitrary code.Original patch by Benjamin Peterson
+
+Signed-off-by: Maxin B. John <maxin.john@enea.com>
+---
+diff -r 40fb60df4755 Modules/socketmodule.c
+--- a/Modules/socketmodule.c   Sun Jan 12 12:11:47 2014 +0200
++++ b/Modules/socketmodule.c   Mon Jan 13 16:36:35 2014 -0800
+@@ -2744,6 +2744,13 @@
+         recvlen = buflen;
+     }
++    /* Check if the buffer is large enough */
++    if (buflen < recvlen) {
++        PyErr_SetString(PyExc_ValueError,
++                        "buffer too small for requested bytes");
++        goto error;
++    }
++
+     readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr);
+     if (readlen < 0) {
+         /* Return an error */
index c7bb9b413120ffa459e8622f7fa99b26575d919e..0d641720f11281d3d2cabd51cd170c072d46713b 100644 (file)
@@ -35,6 +35,7 @@ SRC_URI += "\
   file://parallel-makeinst-create-bindir.patch \
   file://python-2.7.3-CVE-2013-1752-smtplib-fix.patch \
   file://python-fix-build-error-with-Readline-6.3.patch \
+  file://python-2.7.3-CVE-2014-1912.patch \
 "
 
 S = "${WORKDIR}/Python-${PV}"