From: Otto Date: Mon, 8 Nov 2021 12:46:49 +0000 (+0100) Subject: Limit max arg length X-Git-Tag: rec-4.6.0-beta1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1991df56f5c0f54703645c36f25b974fe42e3fad;p=thirdparty%2Fpdns.git Limit max arg length --- diff --git a/pdns/rec_channel.cc b/pdns/rec_channel.cc index 41faffddb6..b87e551fb2 100644 --- a/pdns/rec_channel.cc +++ b/pdns/rec_channel.cc @@ -12,6 +12,7 @@ #include #include #include +#include #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) {