[PATCH] gdbserver: fix overlap in sprintf argument and buffer
Christian Biesinger
cbiesinger@google.com
Wed Oct 21 09:50:29 GMT 2020
On Wed, Oct 21, 2020 at 12:05 AM Simon Marchi via Gdb-patches
<gdb-patches@sourceware.org> wrote:
> CXX server.o
> /home/Baube/src/binutils-gdb/gdbserver/server.cc: In function ‘void handle_general_set(char*)’:
> /home/Baube/src/binutils-gdb/gdbserver/server.cc:832:12: error: ‘sprintf’ argument 3 overlaps destination object ‘own_buf’ [-Werror=restrict]
> 832 | sprintf (own_buf, "E.Unknown thread-events mode requested: %s\n",
> | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 833 | mode);
> | ~~~~~
https://sourceware.org/bugzilla/show_bug.cgi?id=26758 was filed on
this, so you should probably link to it in the commit message.
+ sprintf (own_buf, "%s", err.c_str ());
Why not use strcpy?
Christian
More information about the Gdb-patches
mailing list