Skip to content

Commit dceb0f5

Browse files
committed
check dns labels size limits
1 parent ed99f2b commit dceb0f5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/net/dns/names/names.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def pack_name(name)
5252
arr = name.split(".")
5353
str = ""
5454
arr.each do |elem|
55+
if elem.size > 63
56+
raise ArgumentError, "Label data cannot exceed 63 chars"
57+
end
5558
str += [elem.size,elem].pack("Ca*")
5659
end
5760
str += [0].pack("C")

0 commit comments

Comments
 (0)