From b6c6637c3b52a7caf168b1b80afac8b10d567945 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 14 Jul 2009 06:49:16 +0000 Subject: [PATCH] Made IP filter more robust --- src/filterParserThread.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/filterParserThread.h b/src/filterParserThread.h index 9d6ddcd63..de1907fe8 100644 --- a/src/filterParserThread.h +++ b/src/filterParserThread.h @@ -191,8 +191,12 @@ class FilterParserThread : public QThread { if(IPv4) { //IPv4 addresses IP = strStartIP.split('.'); + if(IP.size() != 4) + throw exception(); address_v4 start((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt()); IP = strEndIP.split('.'); + if(IP.size() != 4) + throw exception(); address_v4 last((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt()); // Apply to bittorrent session filter.add_rule(start, last, ip_filter::blocked);