diff options
author | Adam <Adam@anope.org> | 2012-04-06 14:41:28 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-04-06 14:41:28 -0400 |
commit | 9d249ef96f7fa1e6460abb9263417652d7e49c3b (patch) | |
tree | 7886e16785b3e15c4b87196f227a6939856a4668 /src/dns.cpp | |
parent | e03b73e8cdb7dd871b3b2e16ec203e3103be4add (diff) |
Fixed unpacking questions from dns packets
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index ad9c01c7f..25c82e24f 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -205,7 +205,7 @@ Question DNSPacket::UnpackQuestion(const unsigned char *input, unsigned short in question.name = this->UnpackName(input, input_size, pos); - if (pos + 4 >= input_size) + if (pos + 4 > input_size) throw SocketException("Unable to unpack question"); question.type = static_cast<QueryType>(input[pos] << 8 | input[pos + 1]); @@ -221,7 +221,7 @@ ResourceRecord DNSPacket::UnpackResourceRecord(const unsigned char *input, unsig { ResourceRecord record = static_cast<ResourceRecord>(this->UnpackQuestion(input, input_size, pos)); - if (pos + 6 >= input_size) + if (pos + 6 > input_size) throw SocketException("Unable to unpack resource record"); record.ttl = (input[pos] << 24) | (input[pos + 1] << 16) | (input[pos + 2] << 8) | input[pos + 3]; |