X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcidr.cpp;h=f45c63b98d6d0461f43efd9a8c4c99f3f4dbf843;hb=e2b0f3dc9ef4d56c71d7abda13e6139ca092e387;hp=250ad9c69b0d716dc6cee3b2758fec1bede6b6e7;hpb=3ccae741b8c60acc2d95f2dc54d7e69014090807;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cidr.cpp b/src/cidr.cpp index 250ad9c69..f45c63b98 100644 --- a/src/cidr.cpp +++ b/src/cidr.cpp @@ -1,9 +1,13 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2008 Craig Edwards + * Copyright (C) 2019 Sadie Powell + * Copyright (C) 2014-2015 Attila Molnar + * Copyright (C) 2012 Robby + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2008 Robin Burchell + * Copyright (C) 2008 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -33,7 +37,7 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr /* The caller is trying to match ident@/bits. * Chop off the ident@ portion, use match() on it - * seperately. + * separately. */ if (match_with_username) { @@ -73,7 +77,11 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr } irc::sockets::sockaddrs addr; - irc::sockets::aptosa(address_copy, 0, addr); + if (!irc::sockets::aptosa(address_copy, 0, addr)) + { + // The address could not be parsed. + return false; + } irc::sockets::cidr_mask mask(cidr_copy); irc::sockets::cidr_mask mask2(addr, mask.length);