Fix nullptr in with_command_1

Running 'with' without arguments crashes GDB.  This fixes it.

gdb/ChangeLog:
2019-08-21  Bogdan Harjoc  <harjoc@gmail.com>

	* cli/cli-cmds.c (with_command_1): Error out if no arguments.

gdb/testsuite/ChangeLog:
2019-08-21  Pedro Alves  <palves@redhat.com>

	* gdb.base/with.exp: Test "with" with no arguments.
This commit is contained in:
Pedro Alves
2019-08-21 21:11:33 +01:00
parent c07aae6e72
commit 26c957f127
4 changed files with 13 additions and 0 deletions

View File

@ -217,6 +217,9 @@ void
with_command_1 (const char *set_cmd_prefix,
cmd_list_element *setlist, const char *args, int from_tty)
{
if (args == nullptr)
error (_("Missing arguments."));
const char *delim = strstr (args, "--");
const char *nested_cmd = nullptr;