aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-11-22 12:22:11 +0000
committerYao Qi <yao.qi@linaro.org>2017-11-22 12:22:11 +0000
commita9f26f609e3a1b6ae3aab300b55442e0a81e2bce (patch)
treef8eb85e7a41177838af4fa3aa1ea6c8956162025 /gdb/python
parent29f9a5673764c1b2711c0ceeba380a6ee764d1b2 (diff)
downloadgdb-a9f26f609e3a1b6ae3aab300b55442e0a81e2bce.zip
gdb-a9f26f609e3a1b6ae3aab300b55442e0a81e2bce.tar.gz
gdb-a9f26f609e3a1b6ae3aab300b55442e0a81e2bce.tar.bz2
Fix build with GCC 8: strncpy ->strcpy
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 <yao.qi@linaro.org> * python/py-gdb-readline.c (gdbpy_readline_wrapper): Use strcpy.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-gdb-readline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index a02fa8c..ab14b8c 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';
}