tools/gdbsx: fix -Wstringop-truncation warning

gcc-8 complains:

    gx_main.c: In function 'prepare_stop_reply':
    gx_main.c:385:9: error: 'strncpy' output truncated before terminating nul copying 6 bytes from a string of the same length [-Werror=stringop-truncation]
             strncpy(buf, "watch:", 6);
             ^~~~~~~~~~~~~~~~~~~~~~~~~

Since terminating '\0' isn't needed here at all, switch to memcpy.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-Acked-by: Juergen Gross <jgross@suse.com>
(cherry picked from commit 7f601f7c34)
This commit is contained in:
Marek Marczykowski-Górecki authored and Ian Jackson committed 2020-06-12 17:01:39 +01:00
1 parent f034ab45c1
commit f1e75e5c70
1 file changed
+1 -1
+1 -1
View File
@@ -382,7 +382,7 @@ prepare_stop_reply(enum target_signal sig, char *buf, vcpuid_t vcpu)
/* TBD: check if we stopped because of watchpoint */
if (watchpoint_stop()) {
strncpy(buf, "watch:", 6);
memcpy(buf, "watch:", 6);
buf += 6;
/* TBD: **/
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.