|
|
@ -417,7 +417,7 @@ int FilterParserThread::parseP2BFilterFile() |
|
|
|
unsigned char version; |
|
|
|
unsigned char version; |
|
|
|
if (!stream.readRawData(buf, sizeof(buf)) |
|
|
|
if (!stream.readRawData(buf, sizeof(buf)) |
|
|
|
|| memcmp(buf, "\xFF\xFF\xFF\xFFP2B", 7) |
|
|
|
|| memcmp(buf, "\xFF\xFF\xFF\xFFP2B", 7) |
|
|
|
|| !stream.readRawData((char*)&version, sizeof(version))) { |
|
|
|
|| !stream.readRawData(reinterpret_cast<char*>(&version), sizeof(version))) { |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
return ruleCount; |
|
|
|
return ruleCount; |
|
|
|
} |
|
|
|
} |
|
|
@ -428,8 +428,8 @@ int FilterParserThread::parseP2BFilterFile() |
|
|
|
|
|
|
|
|
|
|
|
std::string name; |
|
|
|
std::string name; |
|
|
|
while(getlineInStream(stream, name, '\0') && !m_abort) { |
|
|
|
while(getlineInStream(stream, name, '\0') && !m_abort) { |
|
|
|
if (!stream.readRawData((char*)&start, sizeof(start)) |
|
|
|
if (!stream.readRawData(reinterpret_cast<char*>(&start), sizeof(start)) |
|
|
|
|| !stream.readRawData((char*)&end, sizeof(end))) { |
|
|
|
|| !stream.readRawData(reinterpret_cast<char*>(&end), sizeof(end))) { |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
return ruleCount; |
|
|
|
return ruleCount; |
|
|
|
} |
|
|
|
} |
|
|
@ -450,7 +450,7 @@ int FilterParserThread::parseP2BFilterFile() |
|
|
|
else if (version == 3) { |
|
|
|
else if (version == 3) { |
|
|
|
qDebug ("p2b version 3"); |
|
|
|
qDebug ("p2b version 3"); |
|
|
|
unsigned int namecount; |
|
|
|
unsigned int namecount; |
|
|
|
if (!stream.readRawData((char*)&namecount, sizeof(namecount))) { |
|
|
|
if (!stream.readRawData(reinterpret_cast<char*>(&namecount), sizeof(namecount))) { |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
return ruleCount; |
|
|
|
return ruleCount; |
|
|
|
} |
|
|
|
} |
|
|
@ -469,7 +469,7 @@ int FilterParserThread::parseP2BFilterFile() |
|
|
|
|
|
|
|
|
|
|
|
// Reading the ranges
|
|
|
|
// Reading the ranges
|
|
|
|
unsigned int rangecount; |
|
|
|
unsigned int rangecount; |
|
|
|
if (!stream.readRawData((char*)&rangecount, sizeof(rangecount))) { |
|
|
|
if (!stream.readRawData(reinterpret_cast<char*>(&rangecount), sizeof(rangecount))) { |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
return ruleCount; |
|
|
|
return ruleCount; |
|
|
|
} |
|
|
|
} |
|
|
@ -477,9 +477,9 @@ int FilterParserThread::parseP2BFilterFile() |
|
|
|
rangecount = ntohl(rangecount); |
|
|
|
rangecount = ntohl(rangecount); |
|
|
|
unsigned int name, start, end; |
|
|
|
unsigned int name, start, end; |
|
|
|
for (unsigned int i = 0; i < rangecount; ++i) { |
|
|
|
for (unsigned int i = 0; i < rangecount; ++i) { |
|
|
|
if (!stream.readRawData((char*)&name, sizeof(name)) |
|
|
|
if (!stream.readRawData(reinterpret_cast<char*>(&name), sizeof(name)) |
|
|
|
|| !stream.readRawData((char*)&start, sizeof(start)) |
|
|
|
|| !stream.readRawData(reinterpret_cast<char*>(&start), sizeof(start)) |
|
|
|
|| !stream.readRawData((char*)&end, sizeof(end))) { |
|
|
|
|| !stream.readRawData(reinterpret_cast<char*>(&end), sizeof(end))) { |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); |
|
|
|
return ruleCount; |
|
|
|
return ruleCount; |
|
|
|
} |
|
|
|
} |
|
|
|