summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2022-05-22 20:46:04 -0400
committer AJR <ajrhacker@users.noreply.github.com>2022-05-22 20:46:28 -0400
commit88dc7bcf92b4b1ac96c1186c3bc70fec53b207e1 (patch)
tree39162133fa77a00916526d8c3d17dc19c98c253c /src/emu/debug
parentc24dc4a0e178d6975a30e4d1d69f5c559288d5f7 (diff)
debugger: Impose an arbitrary upper limit on the count parameter of the gni command to prevent denial of service
Diffstat (limited to 'src/emu/debug')
-rw-r--r--src/emu/debug/debugcmd.cpp6
-rw-r--r--src/emu/debug/debughlp.cpp3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index ff29281ab64..781ce93e9a5 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -1382,12 +1382,18 @@ void debugger_commands::execute_go_branch(bool sense, const std::vector<std::str
void debugger_commands::execute_go_next_instruction(const std::vector<std::string> &params)
{
u64 count = 1;
+ static constexpr u64 MAX_COUNT = 512;
// if we have a parameter, use it instead */
if (params.size() > 0 && !validate_number_parameter(params[0], count))
return;
if (count == 0)
return;
+ if (count > MAX_COUNT)
+ {
+ m_console.printf("Too many instructions (must be %d or fewer)\n", MAX_COUNT);
+ return;
+ }
device_state_interface *stateintf;
device_t *cpu = m_machine.debugger().console().get_visible_cpu();
diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp
index dd2a506cde8..a62704c5472 100644
--- a/src/emu/debug/debughlp.cpp
+++ b/src/emu/debug/debughlp.cpp
@@ -978,7 +978,8 @@ const help_item f_static_help_list[] =
"debugger until a breakpoint or watchpoint is hit, or until you manually break in using the "
"assigned key. Before executing, the gni command sets a temporary unconditional breakpoint "
"<count> instructions sequentially past the current one, which is automatically removed when "
- "hit. If <count> is omitted, its default value is 1."
+ "hit. If <count> is omitted, its default value is 1. If <count> is specified as zero, the "
+ "command does nothing. <count> is not permitted to exceed 512 decimal."
"\n"
"Examples:\n"
"\n"