code: plan9front

Download patch

ref: 453d3c3d4c96899c7bbca81b8a143ac7a934aebe
parent: 78eff200d85e0fc2f92622d221c0e3d81aaf9522
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Oct 30 18:18:07 EDT 2023

ndb/dns: make sure theres only a single Topt option in getednsopt().

--- a/sys/src/cmd/ndb/dnresolve.c
+++ b/sys/src/cmd/ndb/dnresolve.c
@@ -502,14 +502,21 @@
 RR*
 getednsopt(DNSmsg *mp)
 {
-	RR *rp;
+	RR *rp, *x;
 
 	rp = rrremtype(&mp->ar, Topt);
 	if(rp == nil)
 		return nil;
 	mp->arcount--;
+	while((x = rp->next) != nil){
+		rp->next = x->next;
+		rrfree(x);
+		mp->arcount--;
+	}
+
 	if(rp->udpsize < 512)
 		rp->udpsize = 512;
+
 	return rp;
 }