From 5ca0b22f3d6ba7ab0ae8490b13b2792b29d2c1b4 Mon Sep 17 00:00:00 2001 From: Pietro Donatini Date: Mon, 15 Jun 2026 13:34:10 +0200 Subject: [PATCH] Fix WKS record protocol field encoding and decoding size according to RFC 1035 Section 3.4.2 where PROTOCOL is an 8 bit --- lib/dnsruby/resource/IN.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dnsruby/resource/IN.rb b/lib/dnsruby/resource/IN.rb index cccfc77..16c6947 100644 --- a/lib/dnsruby/resource/IN.rb +++ b/lib/dnsruby/resource/IN.rb @@ -87,13 +87,13 @@ def initialize(address, protocol, bitmap) def encode_rdata(msg, canonical=false) #:nodoc: all msg.put_bytes(@address.address) - msg.put_pack("n", @protocol) + msg.put_pack("C", @protocol) msg.put_bytes(@bitmap) end def self.decode_rdata(msg) #:nodoc: all address = IPv4.new(msg.get_bytes(4)) - protocol, = msg.get_unpack("n") + protocol, = msg.get_unpack("C") bitmap = msg.get_bytes return self.new(address, protocol, bitmap) end