From d7b546243f9418309171f530dfed82e825f5b89b Mon Sep 17 00:00:00 2001 From: JAJames Date: Thu, 28 Jan 2016 22:23:38 -0500 Subject: [PATCH] Fixed parsing of IP parameter in "AddBan" and "AddExemption" IRC commands. --- RenX.Commands/RenX_Commands.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/RenX.Commands/RenX_Commands.cpp b/RenX.Commands/RenX_Commands.cpp index dc116d3..b8d6894 100644 --- a/RenX.Commands/RenX_Commands.cpp +++ b/RenX.Commands/RenX_Commands.cpp @@ -2168,10 +2168,11 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c index = ip_str.find('/'); if (index != JUPITER_INVALID_INDEX) { - prefix_length = Jupiter::ReferenceString::substring(ip_str, index + 1).asUnsignedInt(); + Jupiter::ReferenceString prefix_length_str(ip_str.c_str() + index + 1); + prefix_length = prefix_length_str.asUnsignedInt(); if (prefix_length == 0) prefix_length = 32U; - ip_str.set(ip_str.ptr(), index); + ip_str.truncate(prefix_length_str.size() + 1); } ip = Jupiter::Socket::pton4(ip_str.c_str()); @@ -2565,10 +2566,11 @@ void AddExemptionIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStr index = ip_str.find('/'); if (index != JUPITER_INVALID_INDEX) { - prefix_length = Jupiter::ReferenceString::substring(ip_str, index + 1).asUnsignedInt(); + Jupiter::ReferenceString prefix_length_str(ip_str.c_str() + index + 1); + prefix_length = prefix_length_str.asUnsignedInt(); if (prefix_length == 0) prefix_length = 32U; - ip_str.set(ip_str.ptr(), index); + ip_str.truncate(prefix_length_str.size() + 1); } ip = Jupiter::Socket::pton4(ip_str.c_str());