From 26e72c68573a1891692680cd2ef75e65f7f87cb1 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 17 Sep 2023 22:20:27 -0400 Subject: [PATCH] [Bug Fix] Add Validation to #find, #set, and #show args (#3598) # Notes - We were not validating `sep->arg[i]` so we could possibly be pushing a `nullptr` in. --- zone/gm_commands/find.cpp | 4 +++- zone/gm_commands/set.cpp | 4 +++- zone/gm_commands/show.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/zone/gm_commands/find.cpp b/zone/gm_commands/find.cpp index 126de26b5..2c959c1eb 100644 --- a/zone/gm_commands/find.cpp +++ b/zone/gm_commands/find.cpp @@ -72,7 +72,9 @@ void command_find(Client *c, const Seperator *sep) // skip the first arg for (auto i = 1; i <= arguments; i++) { - args.emplace_back(sep->arg[i]); + if (sep->arg[i]) { + args.emplace_back(sep->arg[i]); + } } // build the rewrite string diff --git a/zone/gm_commands/set.cpp b/zone/gm_commands/set.cpp index 8626db5cc..0f70d4061 100644 --- a/zone/gm_commands/set.cpp +++ b/zone/gm_commands/set.cpp @@ -136,7 +136,9 @@ void command_set(Client *c, const Seperator *sep) // skip the first arg for (auto i = 1; i <= arguments; i++) { - args.emplace_back(sep->arg[i]); + if (sep->arg[i]) { + args.emplace_back(sep->arg[i]); + } } // build the rewrite string diff --git a/zone/gm_commands/show.cpp b/zone/gm_commands/show.cpp index 2bea01355..bb7343bf3 100755 --- a/zone/gm_commands/show.cpp +++ b/zone/gm_commands/show.cpp @@ -115,7 +115,9 @@ void command_show(Client *c, const Seperator *sep) // skip the first arg for (auto i = 1; i <= arguments; i++) { - args.emplace_back(sep->arg[i]); + if (sep->arg[i]) { + args.emplace_back(sep->arg[i]); + } } // build the rewrite string