binutils-gdb/gdb/cli
Yao Qi 29f9a56737 Fix build with GCC 8: strncpy -> memcpy
Recent gcc 8 trunk emits the warning below,

../../../binutils-gdb/gdb/gdbserver/remote-utils.c:1204:14: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation]
      strncpy (buf, "watch:", 6);
      ~~~~~~~~^~~~~~~~~~~~~~~~~~

../../binutils-gdb/gdb/cli/cli-decode.c:1118:15: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
       strncpy (cmdtype1 + 1, cmdtype, len - 1);
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/cli/cli-decode.c:1110:16: note: length computed here
   len = strlen (cmdtype);
         ~~~~~~~^~~~~~~~~
../../binutils-gdb/gdb/cli/cli-decode.c:1120:15: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
       strncpy (cmdtype2, cmdtype, len - 1);
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/cli/cli-decode.c:1110:16: note: length computed here
   len = strlen (cmdtype);
         ~~~~~~~^~~~~~~~~

../../binutils-gdb/gdb/cp-namespace.c:1071:11: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 2 bytes from a string of the same length [-Werror=stringop-truncation]
   strncpy (full_name + scope_length, "::", 2);
   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes it by using memcpy instead of strncpy.

gdb:

2017-11-22  Yao Qi  <yao.qi@linaro.org>

	* cli/cli-decode.c (help_list): Use memcpy instead of strncpy.
	* cp-namespace.c (cp_lookup_transparent_type_loop): Likewise.

gdb/gdbserver:

2017-11-22  Yao Qi  <yao.qi@linaro.org>

	* remote-utils.c (prepare_resume_reply): Use memcpy.
2017-11-22 12:22:11 +00:00
..
cli-cmds.c Constify add_info 2017-11-07 13:59:09 -07:00
cli-cmds.h Constify add_com 2017-11-07 13:59:09 -07:00
cli-decode.c Fix build with GCC 8: strncpy -> memcpy 2017-11-22 12:22:11 +00:00
cli-decode.h Constify execute_command 2017-11-07 13:59:09 -07:00
cli-dump.c Constify execute_command 2017-11-07 13:59:09 -07:00
cli-interp.c Constify execute_command 2017-11-07 13:59:09 -07:00
cli-interp.h C++-fy struct interp/cli_interp/tui_interp/mi_interp 2017-02-03 16:30:04 +00:00
cli-logging.c Constify add_setshow_* 2017-11-07 13:59:09 -07:00
cli-script.c Constify execute_command 2017-11-07 13:59:09 -07:00
cli-script.h Constify execute_command 2017-11-07 13:59:09 -07:00
cli-setshow.c Rename _const functions to use overloading instead 2017-09-11 15:46:12 -06:00
cli-setshow.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
cli-utils.c Make breakpoint/location number parsing error output consistent 2017-11-07 11:07:19 +00:00
cli-utils.h Make extract_arg return a std::string 2017-09-11 15:46:14 -06:00