diff --git a/lib/rex/proto/dns/cached_resolver.rb b/lib/rex/proto/dns/cached_resolver.rb index 5fd92ae31a53..1b02b23ee003 100644 --- a/lib/rex/proto/dns/cached_resolver.rb +++ b/lib/rex/proto/dns/cached_resolver.rb @@ -62,7 +62,11 @@ def send(argument, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN) resolved = super(resolve, type) req.instance_variable_set(:@answer, (req.answer + resolved.answer).uniq) resolved.answer.each do |ans| - self.cache.cache_record(ans) + begin + self.cache.cache_record(ans) + rescue StandardError => e + elog('Failed to cache the DNS answer', error: e) + end end end # Finalize answers in response