From 26c957f12762816a90d5145c7c527ca48c890855 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 21 Aug 2019 21:11:33 +0100 Subject: Fix nullptr in with_command_1 Running 'with' without arguments crashes GDB. This fixes it. gdb/ChangeLog: 2019-08-21 Bogdan Harjoc * cli/cli-cmds.c (with_command_1): Error out if no arguments. gdb/testsuite/ChangeLog: 2019-08-21 Pedro Alves * gdb.base/with.exp: Test "with" with no arguments. --- gdb/cli/cli-cmds.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 30e0958..4fc6567 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; -- cgit v1.1