From ebd9bd75a592d071d8549e874ee4a05b2204597f Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sun, 28 Apr 2024 16:17:28 +0200 Subject: [PATCH] Prevent a basic hack. --- src/storage.cr | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storage.cr b/src/storage.cr index bd5dd03..dec3a0f 100644 --- a/src/storage.cr +++ b/src/storage.cr @@ -133,6 +133,8 @@ class DNSManager::Storage end matching_domains.each do |md| + # Prevent empty domains (from crafted requests) to be accepted. + return Response::InvalidDomainName.new unless (domain.chomp md).size > 2 Baguette::Log.info "Add new domain #{domain} (matching domain #{md})" end