diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index fd0a4bfaa54..b1628cdd51a 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2020-10-21 Simon Marchi + + * server.cc (handle_general_set): Don't use sprintf with + argument overlapping buffer. + 2020-10-20 Tom Tromey PR gdb/26742: diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 4a211a48187..16014539224 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -829,8 +829,10 @@ handle_general_set (char *own_buf) else { /* We don't know what this mode is, so complain to GDB. */ - sprintf (own_buf, "E.Unknown thread-events mode requested: %s\n", - mode); + std::string err + = string_printf ("E.Unknown thread-events mode requested: %s\n", + mode); + strcpy (own_buf, err.c_str ()); return; }