diff --git a/lib/modules/Protocols.pmod/DNS.pmod b/lib/modules/Protocols.pmod/DNS.pmod
index 860c5883537bfb49728fcb57728b82eedd209daa..42a560bdc5df399b560dc312f6e425a4819d0544 100644
--- a/lib/modules/Protocols.pmod/DNS.pmod
+++ b/lib/modules/Protocols.pmod/DNS.pmod
@@ -69,7 +69,7 @@ class protocol
     int pos=n[0];
     int next=-1;
     string *ret=({});
-    while(1)
+    while(pos < sizeof(msg))
     {
       switch(int len=msg[pos])
       {
@@ -324,7 +324,7 @@ class client {
 	    }
 	  }
 	  if (sizeof(rest)) {
-	    nameservers += ({ rest });
+	    nameservers = `+(nameservers, ({ rest }));
 	  }
 	  break;
 	}