]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Limit max arg length
authorOtto <otto.moerbeek@open-xchange.com>
Mon, 8 Nov 2021 12:46:49 +0000 (13:46 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Mon, 8 Nov 2021 12:48:11 +0000 (13:48 +0100)
pdns/rec_channel.cc

index 41faffddb649d181724f19fe7d390f26a88f9810..b87e551fb204eceb972c304511fecb32541bd243 100644 (file)
@@ -12,6 +12,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <iostream>
+#include <limits.h>
 
 #include "pdnsexception.hh"
 
@@ -181,6 +182,10 @@ RecursorControlChannel::Answer RecursorControlChannel::recv(int fd, unsigned int
     throw PDNSException("Unable to receive length over control channel: " + stringerror());
   }
 
+  if (len > ARG_MAX) {
+    throw PDNSException("Length of control channel message too large");
+  }
+
   string str;
   str.reserve(len);
   while (str.length() < len) {