From: beware <beware@bircd.org>
Date: Mon, 4 Apr 2011 14:58:41 +0000 (+0000)
Subject: increased maximum RR of a kind limit check
X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/a2d002aadb85c6411b55e3966247efb21eeff2b8?ds=sidebyside;hp=16fce740c1954b4d3e7eb7c2089dd94dc099bc26

increased maximum RR of a kind limit check

git-svn-id: file:///svnroot/lcore/trunk@99 b1de8a11-f9be-4011-bde0-cc7ace90066a
---

diff --git a/dnscore.pas b/dnscore.pas
index fa9eee2..3a9596f 100644
--- a/dnscore.pas
+++ b/dnscore.pas
@@ -106,7 +106,10 @@ const
   querytype_txt=16;
   querytype_spf=99;
   maxrecursion=50;
-  maxrrofakind=20;
+  maxrrofakind=32;
+  {the maximum number of RR of a kind of purely an extra sanity check and could be omitted.
+  before, i set it to 20, but valid replies can have more. dnscore only does udp requests,
+  and ordinary DNS, so up to 512 bytes. the maximum number of A records that fits seems to be 29}
 
   retryafter=300000; //microseconds must be less than one second;
   timeoutlag=1000000000; // penalty value to be treated as lag in the event of a timeout (microseconds)
@@ -502,7 +505,10 @@ begin
     state.numrr2 := 0;
     for a := 0 to 3 do begin
       state.numrr1[a] := htons(state.recvpacket.rrcount[a]);
-      if state.numrr1[a] > maxrrofakind then goto failure;
+      if state.numrr1[a] > maxrrofakind then begin
+        failurereason := 'exceeded maximum RR of a kind';
+        goto failure;
+      end;
       inc(state.numrr2,state.numrr1[a]);
     end;