forked from Imagelibrary/binutils-gdb
Do not cast away const in agent_run_command
While investigating something else, I noticed some weird code in agent_run_command (use of memcpy rather than strcpy). Then I noticed that 'cmd' is used as both an in and out parameter, despite being const. Casting away const like this is bad. This patch removes the const and fixes the memcpy. I also added a static assert to assure myself that the code in gdbserver is correct -- gdbserver is passing its own buffer directly to agent_run_command. Reviewed-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
@@ -51,6 +51,11 @@
|
||||
#include "gdbsupport/scoped_restore.h"
|
||||
#include "gdbsupport/search.h"
|
||||
|
||||
/* PBUFSIZ must also be at least as big as IPA_CMD_BUF_SIZE, because
|
||||
the client state data is passed directly to some agent
|
||||
functions. */
|
||||
gdb_static_assert (PBUFSIZ >= IPA_CMD_BUF_SIZE);
|
||||
|
||||
#define require_running_or_return(BUF) \
|
||||
if (!target_running ()) \
|
||||
{ \
|
||||
|
||||
Reference in New Issue
Block a user