]> granicus.if.org Git - python/commit
Fix compiler warning in call_readline() (GH-10820)
authorVictor Stinner <vstinner@redhat.com>
Fri, 30 Nov 2018 14:03:53 +0000 (15:03 +0100)
committerGitHub <noreply@github.com>
Fri, 30 Nov 2018 14:03:53 +0000 (15:03 +0100)
commit1600f60414e620c4298c15dac803427d8f0a977c
tree3f202891b24688921c33c71879140df12f85b587
parentb7c2182604d5796b5af4c837991aa0b8c8a2d41f
Fix compiler warning in call_readline() (GH-10820)

Replace strncpy() with memcpy() in call_readline() to fix the
following warning, the NUL byte is written manually just after:

Modules/readline.c: In function ‘call_readline’:
Modules/readline.c:1303:9: warning: ‘strncpy’ output truncated before
terminating nul copying as many bytes from a string as its length
[-Wstringop-truncation]
         strncpy(p, q, n);
         ^~~~~~~~~~~~~~~~
Modules/readline.c:1279:9: note: length computed here
     n = strlen(p);
         ^~~~~~~~~
Modules/readline.c