mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[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.
This commit is contained in:
parent
df1d740ae6
commit
26e72c6857
@ -72,8 +72,10 @@ void command_find(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
// skip the first arg
|
// skip the first arg
|
||||||
for (auto i = 1; i <= arguments; i++) {
|
for (auto i = 1; i <= arguments; i++) {
|
||||||
|
if (sep->arg[i]) {
|
||||||
args.emplace_back(sep->arg[i]);
|
args.emplace_back(sep->arg[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// build the rewrite string
|
// build the rewrite string
|
||||||
std::string rewrite = fmt::format("#find {} {}", cmd.cmd, Strings::Join(args, " "));
|
std::string rewrite = fmt::format("#find {} {}", cmd.cmd, Strings::Join(args, " "));
|
||||||
|
|||||||
@ -136,8 +136,10 @@ void command_set(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
// skip the first arg
|
// skip the first arg
|
||||||
for (auto i = 1; i <= arguments; i++) {
|
for (auto i = 1; i <= arguments; i++) {
|
||||||
|
if (sep->arg[i]) {
|
||||||
args.emplace_back(sep->arg[i]);
|
args.emplace_back(sep->arg[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// build the rewrite string
|
// build the rewrite string
|
||||||
const std::string& rewrite = fmt::format("#set {} {}", cmd.cmd, Strings::Join(args, " "));
|
const std::string& rewrite = fmt::format("#set {} {}", cmd.cmd, Strings::Join(args, " "));
|
||||||
|
|||||||
@ -115,8 +115,10 @@ void command_show(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
// skip the first arg
|
// skip the first arg
|
||||||
for (auto i = 1; i <= arguments; i++) {
|
for (auto i = 1; i <= arguments; i++) {
|
||||||
|
if (sep->arg[i]) {
|
||||||
args.emplace_back(sep->arg[i]);
|
args.emplace_back(sep->arg[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// build the rewrite string
|
// build the rewrite string
|
||||||
const std::string& rewrite = fmt::format("#show {} {}", cmd.cmd, Strings::Join(args, " "));
|
const std::string& rewrite = fmt::format("#show {} {}", cmd.cmd, Strings::Join(args, " "));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user