From 792ea1608ae69f11a3cd79e517c76a0693d933a4 Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Thu, 14 Jul 2022 03:16:31 -0400 Subject: [PATCH] [Tasks] Fix #task command crash on bad input (#2301) --- zone/gm_commands/task.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zone/gm_commands/task.cpp b/zone/gm_commands/task.cpp index 54573548e..4aa37e32c 100755 --- a/zone/gm_commands/task.cpp +++ b/zone/gm_commands/task.cpp @@ -175,7 +175,7 @@ void command_task(Client *c, const Seperator *sep) } if (is_assign) { - auto task_id = std::stoul(sep->arg[2]); + auto task_id = std::strtoul(sep->arg[2], nullptr, 10); if (task_id && task_id < MAXTASKS) { target->AssignTask(task_id, 0, false); c->Message( @@ -221,7 +221,7 @@ void command_task(Client *c, const Seperator *sep) c->Message(Chat::Yellow, "Successfully reloaded task sets."); return; } else if (!strcasecmp(sep->arg[2], "task") && arguments == 3) { - int task_id = std::stoul(sep->arg[3]); + int task_id = std::strtoul(sep->arg[3], nullptr, 10); if (task_id && task_id < MAXTASKS) { c->Message( Chat::Yellow, @@ -308,12 +308,12 @@ void command_task(Client *c, const Seperator *sep) } } else if (is_update) { if (arguments >= 3) { - auto task_id = std::stoul(sep->arg[2]); - auto activity_id = std::stoul(sep->arg[3]); + auto task_id = std::strtoul(sep->arg[2], nullptr, 10); + auto activity_id = std::strtoul(sep->arg[3], nullptr, 10); int count = 1; if (arguments >= 4) { - count = std::stoi(sep->arg[4]); + count = std::strtol(sep->arg[4], nullptr, 10); if (count <= 0) { count = 1; }