diff options
-rw-r--r-- | Objects/structseq.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/structseq.c b/Objects/structseq.c index 14b5168..82df926 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++) { |