From: Benjamin Peterson Date: Thu, 7 Nov 2019 15:27:03 +0000 (-0800) Subject: bpo-38730: Remove usage of stpncpy as it's not supported on MSVC 2008. (GH-17081) X-Git-Tag: v2.7.18rc1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f94e52e8d38092520a3bfb1bf1ef9cbb0836584;p=thirdparty%2FPython%2Fcpython.git bpo-38730: Remove usage of stpncpy as it's not supported on MSVC 2008. (GH-17081) --- diff --git a/Objects/structseq.c b/Objects/structseq.c index 14b51688a65a..82df926f2860 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -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++) {