Patchwork Fix nullptr in with_command_1

login
register
mail settings
Submitter Bogdan Harjoc
Date Aug. 2, 2019, 12:54 p.m.
Message ID <CAF4+tmqL0NH6mPufUF0y7+-+7=_OC7FXhDOHE+fVC6=RiFa=RQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/33919/
State New
Headers show

Comments

Bogdan Harjoc - Aug. 2, 2019, 12:54 p.m.
Reproduced with gdb built from git HEAD, running 'with' without
arguments. Patch is attached.

Regards,
Bogdan
Tom Tromey - Aug. 2, 2019, 6:04 p.m.
>>>>> "Bogdan" == Bogdan Harjoc <harjoc@gmail.com> writes:

Bogdan> Reproduced with gdb built from git HEAD, running 'with' without
Bogdan> arguments. Patch is attached.

This needs a ChangeLog entry.
I think a simple test case would also be good.

thanks,
Tom

Patch

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 0b62622e88..eb8bb6fc76 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -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;