Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea3592d

Browse files
authored
bpo-36365: Fix compiler warning in structseq.c (GH-12451)
1 parentf7959a9 commitea3592d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎Objects/structseq.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,16 @@ structseq_repr(PyStructSequence *obj)
182182
endofbuf=&buf[REPR_BUFFER_SIZE-5];
183183

184184
/* "typename(", limited to TYPE_MAXSIZE */
185-
len=strlen(typ->tp_name)>TYPE_MAXSIZE ?TYPE_MAXSIZE :
186-
strlen(typ->tp_name);
187-
strncpy(pbuf,typ->tp_name,len);
188-
pbuf+=len;
185+
assert(TYPE_MAXSIZE<sizeof(buf));
186+
len=strlen(typ->tp_name);
187+
if (len <=TYPE_MAXSIZE) {
188+
strcpy(pbuf,typ->tp_name);
189+
pbuf+=len;
190+
}
191+
else {
192+
strncpy(pbuf,typ->tp_name,TYPE_MAXSIZE);
193+
pbuf+=TYPE_MAXSIZE;
194+
}
189195
*pbuf++='(';
190196

191197
for (i=0;i<VISIBLE_SIZE(obj);i++) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp