]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyString_FromString: this requires its argument be non-NULL, but doesn't
authorTim Peters <tim.peters@gmail.com>
Thu, 6 Dec 2001 20:29:32 +0000 (20:29 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 6 Dec 2001 20:29:32 +0000 (20:29 +0000)
check it.  Added an assert() to that effect.

Objects/stringobject.c

index cb0e20b52ba2114e36404eaca43ff7941541f5e0..657b20093b92c39445678405e7f7a3cab245846d 100644 (file)
@@ -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");