summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-12-06 20:29:32 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-12-06 20:29:32 (GMT)
commit62de65b25e56d01a7cd10f55576ff00eae1021fc (patch)
tree9961aaac987341f8ce96cc71ff780711bd90151c /Objects/stringobject.c
parent604ddf80d891f666c677d23b83c3c9f8125ee2b5 (diff)
downloadcpython-62de65b25e56d01a7cd10f55576ff00eae1021fc.zip
cpython-62de65b25e56d01a7cd10f55576ff00eae1021fc.tar.gz
cpython-62de65b25e56d01a7cd10f55576ff00eae1021fc.tar.bz2
PyString_FromString: this requires its argument be non-NULL, but doesn't
check it. Added an assert() to that effect.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index cb0e20b..657b200 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -105,8 +105,11 @@ PyString_FromStringAndSize(const char *str, int size)
PyObject *
PyString_FromString(const char *str)
{
- register size_t size = strlen(str);
+ register size_t size;
register PyStringObject *op;
+
+ assert(str != NULL);
+ size = strlen(str);
if (size > INT_MAX) {
PyErr_SetString(PyExc_OverflowError,
"string is too long for a Python string");