diff Modules/_elementtree.c @ 85018:b3efc140d8a6 2.7

Issue #13612: Fix a buffer overflow in case of a multi-byte encoding. This is a belated backport of f7b47fb30169; Patch by Serhiy Storchaka.
author Eli Bendersky <eliben@gmail.com>
date Sun, 04 Aug 2013 06:09:49 -0700
parents e1dde980a92c
children 395a266bcb5a
line wrap: on
line diff
--- a/Modules/_elementtree.c	Sun Aug 04 13:22:30 2013 +0300
+++ b/Modules/_elementtree.c	Sun Aug 04 06:09:49 2013 -0700
@@ -2427,6 +2427,8 @@
 
     if (PyUnicode_GET_SIZE(u) != 256) {
         Py_DECREF(u);
+        PyErr_SetString(PyExc_ValueError,
+                        "multi-byte encodings are not supported");
         return XML_STATUS_ERROR;
     }