From b42d9d6776b922f685646cb25a8cdbf0c5a261ed Mon Sep 17 00:00:00 2001 From: Anssi Hannula <anssi.hannula@iki.fi> Date: Sat, 13 Nov 2010 07:57:00 +0200 Subject: [PATCH 04/15] fixed: CVE-2008-1887 in internal python (upstream) --- xbmc/lib/libPython/Python/Objects/stringobject.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/xbmc/lib/libPython/Python/Objects/stringobject.c b/xbmc/lib/libPython/Python/Objects/stringobject.c index 7395010..4bd8356 100644 --- a/xbmc/lib/libPython/Python/Objects/stringobject.c +++ b/xbmc/lib/libPython/Python/Objects/stringobject.c @@ -52,6 +52,11 @@ PyObject * PyString_FromStringAndSize(const char *str, int size) { register PyStringObject *op; + if (size < 0) { + PyErr_SetString(PyExc_SystemError, + "Negative size passed to PyString_FromStringAndSize"); + return NULL; + } if (size == 0 && (op = nullstring) != NULL) { #ifdef COUNT_ALLOCS null_strings++; -- 1.7.3