From: Remi Gacogne Date: Tue, 27 Nov 2018 16:16:33 +0000 (+0100) Subject: fuzzing: Skip payloads larger than 65k X-Git-Tag: auth-4.2.0-alpha1~6^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8ffb27d63cc7329b7b949e9e6fe738079e16ab3;p=thirdparty%2Fpdns.git fuzzing: Skip payloads larger than 65k --- diff --git a/pdns/fuzz_dnsdistcache.cc b/pdns/fuzz_dnsdistcache.cc index d9c8efa717..8b2ed7d1fe 100644 --- a/pdns/fuzz_dnsdistcache.cc +++ b/pdns/fuzz_dnsdistcache.cc @@ -24,6 +24,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + if (size > std::numeric_limits::max()) { + return 0; + } + /* dnsdist's version */ try { uint16_t qtype; diff --git a/pdns/fuzz_moadnsparser.cc b/pdns/fuzz_moadnsparser.cc index cf9660ec7d..ea5fe25e9f 100644 --- a/pdns/fuzz_moadnsparser.cc +++ b/pdns/fuzz_moadnsparser.cc @@ -39,6 +39,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { initialized = true; } + if (size > std::numeric_limits::max()) { + return 0; + } + try { MOADNSParser moaQuery(true, reinterpret_cast(data), size); } diff --git a/pdns/fuzz_packetcache.cc b/pdns/fuzz_packetcache.cc index b8d9f22616..faea016920 100644 --- a/pdns/fuzz_packetcache.cc +++ b/pdns/fuzz_packetcache.cc @@ -27,6 +27,10 @@ StatBag S; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + if (size > std::numeric_limits::max()) { + return 0; + } + std::string input(reinterpret_cast(data), size); /* auth's version */