Skip to content

Commit 52837f8

Browse files
committed
Changed truncation behaviour to be less corrupting.
1 parent 1958255 commit 52837f8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/rubydns/handler.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ def receive_data(data)
6565
@server.logger.warn "Response via UDP was larger than #{UDP_TRUNCATION_SIZE}!"
6666

6767
# Reencode data with truncation flag marked as true:
68-
answer.tc = 1
69-
data = answer.encode.byteslice(0, UDP_TRUNCATION_SIZE)
68+
truncation_error = Resolv::DNS::Message.new(answer.id)
69+
truncation_error.tc = 1
70+
71+
data = truncation_error.encode
7072
end
7173

7274
self.send_data(data)

0 commit comments

Comments
 (0)