/* Pause all */
   target_stop (ptid);
 
-  memcpy (s, "qTfSTM", sizeof ("qTfSTM"));
-  s[sizeof ("qTfSTM")] = 0;
-
+  strcpy (s, "qTfSTM");
   agent_run_command (pid, s, strlen (s) + 1);
 
   /* Unpause all.  */
        }
       while (*p++ == ',');     /* comma-separated list */
 
-      memcpy (s, "qTsSTM", sizeof ("qTsSTM"));
-      s[sizeof ("qTsSTM")] = 0;
+      strcpy (s, "qTsSTM");
       agent_run_command (pid, s, strlen (s) + 1);
       p = s;
     }
 
 #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 ())                      \
     {                                          \
 
   target_pause_all (false);
   uninsert_all_breakpoints ();
 
-  err = agent_run_command (pid, (const char *) cmd, len);
+  err = agent_run_command (pid, cmd, len);
 
   reinsert_all_breakpoints ();
   target_unpause_all (false);
 
 #endif
 }
 
-/* Execute an agent command in the inferior.  PID is the value of pid of the
-   inferior.  CMD is the buffer for command.  GDB or GDBserver will store the
-   command into it and fetch the return result from CMD.  The interaction
-   between GDB/GDBserver and the agent is synchronized by a synchronization
-   socket.  Return zero if success, otherwise return non-zero.  */
+/* Execute an agent command in the inferior.  PID is the value of pid
+   of the inferior.  CMD is the buffer for command.  It is assumed to
+   be at least IPA_CMD_BUF_SIZE bytes long.  GDB or GDBserver will
+   store the command into it and fetch the return result from CMD.
+   The interaction between GDB/GDBserver and the agent is synchronized
+   by a synchronization socket.  Return zero if success, otherwise
+   return non-zero.  */
 
 int
-agent_run_command (int pid, const char *cmd, int len)
+agent_run_command (int pid, char *cmd, int len)
 {
   int fd;
   int tid = agent_get_helper_thread_id ();
 
 
 #include "gdbsupport/preprocessor.h"
 
-int agent_run_command (int pid, const char *cmd, int len);
+int agent_run_command (int pid, char *cmd, int len);
 
 int agent_look_up_symbols (void *);