summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-06-09 15:08:41 (GMT)
committerGuido van Rossum <guido@python.org>1998-06-09 15:08:41 (GMT)
commit4a0144c0de212e2bf63fe111939b4085cdd154df (patch)
tree3b45b7c2ce0e95e2cdaa16ec90553cc4a11ac7e0 /Objects/stringobject.c
parentfe02efdbf44628329919991a4ea181183b2da9ff (diff)
downloadcpython-4a0144c0de212e2bf63fe111939b4085cdd154df.zip
cpython-4a0144c0de212e2bf63fe111939b4085cdd154df.tar.gz
cpython-4a0144c0de212e2bf63fe111939b4085cdd154df.tar.bz2
Should check that PyObject_Str() really returned a string!
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 5e6a5a5..dffc8e0 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -900,6 +900,11 @@ PyString_Format(format, args)
temp = PyObject_Str(v);
if (temp == NULL)
goto error;
+ if (!PyString_Check(temp)) {
+ PyErr_SetString(PyExc_TypeError,
+ "%s argument has non-string str()");
+ goto error;
+ }
buf = PyString_AsString(temp);
len = PyString_Size(temp);
if (prec >= 0 && len > prec)