]> granicus.if.org Git - python/commitdiff
structseq_new(): Conversion of sprintf() to PyOS_snprintf() for buffer
authorBarry Warsaw <barry@python.org>
Wed, 28 Nov 2001 20:56:44 +0000 (20:56 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 28 Nov 2001 20:56:44 +0000 (20:56 +0000)
overrun avoidance.

Objects/structseq.c

index 7ad607b0e39da0ecc9758c8287ef41424ef6064a..2ab9b52055b09b4130a29fe5505cd5ef8bf29281 100644 (file)
@@ -102,7 +102,8 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        len = PySequence_Length(arg);
        required_len = REAL_SIZE_TP(type);
        if (len != required_len) {
-               sprintf(msgbuf,
+               PyOS_snprintf(
+                       msgbuf, sizeof(msgbuf),
                        "constructor takes exactly %d arguments (%d given)",
                        required_len,
                        len);