Skip to content

Commit

Permalink
tools/gdbsx: fix -Wstringop-truncation warning
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 7f601f7)
Cherry-pick-repository: https://xenbits.xen.org/gitweb/?p=xen.git
Issue: ALB-3594
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
  • Loading branch information
marmarek authored and AndreiCherechesu-NXP committed Mar 19, 2019
1 parent 5437266 commit c1821ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/debugger/gdbsx/gx/gx_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: **/
}
Expand Down

0 comments on commit c1821ea

Please sign in to comment.