From a9f26f609e3a1b6ae3aab300b55442e0a81e2bce Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 22 Nov 2017 12:22:11 +0000 Subject: Fix build with GCC 8: strncpy ->strcpy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent gcc 8 trunk emits the warning below, ../../binutils-gdb/gdb/python/py-gdb-readline.c:79:15: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy (q, p, n); ~~~~~~~~^~~~~~~~~ ../../binutils-gdb/gdb/python/py-gdb-readline.c:73:14: note: length computed here n = strlen (p); ~~~~~~~^~~ gdb: 2017-11-22 Yao Qi * python/py-gdb-readline.c (gdbpy_readline_wrapper): Use strcpy. --- gdb/python/py-gdb-readline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/python/py-gdb-readline.c') diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c index a02fa8ce6f1..ab14b8c8e8b 100644 --- a/gdb/python/py-gdb-readline.c +++ b/gdb/python/py-gdb-readline.c @@ -76,7 +76,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout, q = (char *) PyMem_RawMalloc (n + 2); if (q != NULL) { - strncpy (q, p, n); + strcpy (q, p); q[n] = '\n'; q[n + 1] = '\0'; } -- cgit v1.2.1