]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Drop truncated UDP messages caused by a small buffer. 2939/head
authorRemi Gacogne <rgacogne-github@coredump.fr>
Thu, 26 Nov 2015 14:55:04 +0000 (15:55 +0100)
committerRemi Gacogne <rgacogne-github@coredump.fr>
Thu, 26 Nov 2015 14:55:04 +0000 (15:55 +0100)
When we receive a message too large for our buffer, recvmsg() will
truncate the content to fit the buffer and set the MSG_TRUNC flag.
There is no point in trying to parse this message because we will
choke during the parsing anyway.

pdns/dnsdist.cc

index fc72f8316d2c5fc611298a39136cbf05b84f6ae9..d189d3f0ef68bb91c35495d9e98e9034874cecca 100644 (file)
@@ -439,6 +439,13 @@ try
        continue;
       }
 
+      if (msgh.msg_flags & MSG_TRUNC) {
+        /* message was too large for our buffer */
+        vinfolog("Dropping message too large for our buffer");
+        g_stats.nonCompliantQueries++;
+        continue;
+      }
+
       g_stats.queries++;
       if(!acl->match(remote)) {
        vinfolog("Query from %s dropped because of ACL", remote.toStringWithPort());