From baaf96d6de8964d53aad423e6d172f3435056f6f Mon Sep 17 00:00:00 2001
From: Phil <phil@secdev.org>
Date: Thu, 23 Aug 2007 14:51:03 +0200
Subject: [PATCH] Fixed DNSStrField.i2m() by truncating chunks of more than 63
 bytes because they cannot be encoded (ticket #42)

---
 scapy.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scapy.py b/scapy.py
index 5c7c3160..23626a08 100755
--- a/scapy.py
+++ b/scapy.py
@@ -4454,7 +4454,7 @@ class TCPOptionsField(StrField):
 
 class DNSStrField(StrField):
     def i2m(self, pkt, x):
-        x = x.split(".")
+        x = [k[:63] for k in x.split(".")] # Truncate chunks that cannont be encoded (more than 63 bytes..)
         x = map(lambda y: chr(len(y))+y, x)
         x = "".join(x)
         if x[-1] != "\x00":
-- 
GitLab