Fix crash in SPF DNS usage
authorSimon Arlott <sa.me.uk>
Tue, 10 Oct 2023 11:31:58 +0000 (12:31 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 10 Oct 2023 11:31:58 +0000 (12:31 +0100)
Broken-by: 8ab9474f0355
src/src/spf.c

index 100e22243502edbd3739a954b68ac20a9e1e6cd2..ef55520b10041a5d010540aebb5ae528e0260efb 100644 (file)
@@ -97,7 +97,8 @@ switch (dns_lookup(dnsa, US domain, rr_type, NULL))
     srr.herrno = NETDB_SUCCESS;
     for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
         rr = dns_next_rr(dnsa, &dnss, RESET_NEXT))
-      if (rr->type == rr_type) { found++; break; }
+      /* Need to alloc space for all records, so no early-out */
+      if (rr->type == rr_type) found++;
     break;
   }