diff options
author | Benjamin Peterson <benjamin@python.org> | 2019-11-07 15:06:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-07 15:06:28 (GMT) |
commit | f32bcf8c27f3681407707bbb029323eb340d3c4b (patch) | |
tree | 1c6d804a1562ac4f5b5734c18c8635fd7822fb8f /Objects/structseq.c | |
parent | 089e5f52a34377193a9e6c03088114b14c8507af (diff) | |
download | cpython-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.c | 5 |
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++) { |