]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38730: Remove usage of stpncpy as it's not supported on MSVC 2008. (GH-17081)
authorBenjamin Peterson <benjamin@python.org>
Thu, 7 Nov 2019 15:27:03 +0000 (07:27 -0800)
committerGitHub <noreply@github.com>
Thu, 7 Nov 2019 15:27:03 +0000 (07:27 -0800)
Objects/structseq.c

index 14b51688a65a27d8481d4129f574987d8e3148bb..82df926f2860425597dd1d1add83c24443e48511 100644 (file)
@@ -252,7 +252,12 @@ structseq_repr(PyStructSequence *obj)
     }
 
     /* "typename(", limited to  TYPE_MAXSIZE */
-    pbuf = stpncpy(pbuf, typ->tp_name, TYPE_MAXSIZE);
+    len = strlen(typ->tp_name);
+    if (len > TYPE_MAXSIZE) {
+        len = TYPE_MAXSIZE;
+    }
+    pbuf = memcpy(pbuf, typ->tp_name, len);
+    pbuf += len;
     *pbuf++ = '(';
 
     for (i=0; i < VISIBLE_SIZE(obj); i++) {