summaryrefslogtreecommitdiffstats
path: root/Objects/structseq.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2019-11-07 15:06:28 (GMT)
committerGitHub <noreply@github.com>2019-11-07 15:06:28 (GMT)
commitf32bcf8c27f3681407707bbb029323eb340d3c4b (patch)
tree1c6d804a1562ac4f5b5734c18c8635fd7822fb8f /Objects/structseq.c
parent089e5f52a34377193a9e6c03088114b14c8507af (diff)
downloadcpython-f32bcf8c27f3681407707bbb029323eb340d3c4b.zip
cpython-f32bcf8c27f3681407707bbb029323eb340d3c4b.tar.gz
cpython-f32bcf8c27f3681407707bbb029323eb340d3c4b.tar.bz2
[2.7] bpo-38730: Fix -Wstringop-truncation warnings. (GH-17075)
Diffstat (limited to 'Objects/structseq.c')
-rw-r--r--Objects/structseq.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Objects/structseq.c b/Objects/structseq.c
index aee9528..14b5168 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -252,10 +252,7 @@ structseq_repr(PyStructSequence *obj)
}
/* "typename(", limited to TYPE_MAXSIZE */
- len = strlen(typ->tp_name) > TYPE_MAXSIZE ? TYPE_MAXSIZE :
- strlen(typ->tp_name);
- strncpy(pbuf, typ->tp_name, len);
- pbuf += len;
+ pbuf = stpncpy(pbuf, typ->tp_name, TYPE_MAXSIZE);
*pbuf++ = '(';
for (i=0; i < VISIBLE_SIZE(obj); i++) {