From d213dae57cb3e49149bcfe9e0e46871c70e28af8 Mon Sep 17 00:00:00 2001 From: keykey7 <29210485+keykey7@users.noreply.github.com> Date: Wed, 11 Jan 2023 21:32:00 +0100 Subject: [PATCH] SPF ip-records have an optional prefix appended --- app/src/main/java/eu/faircode/email/ActivityDmarc.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityDmarc.java b/app/src/main/java/eu/faircode/email/ActivityDmarc.java index e84b9c1c91..9d2ecd14ac 100644 --- a/app/src/main/java/eu/faircode/email/ActivityDmarc.java +++ b/app/src/main/java/eu/faircode/email/ActivityDmarc.java @@ -272,9 +272,11 @@ public class ActivityDmarc extends ActivityBase { ip = ip.toLowerCase(Locale.ROOT); if (ip.startsWith("ip4:") || ip.startsWith("ip6:")) { String[] net = ip.substring(4).split("/"); - if (net.length != 2) + if (net.length > 2) continue; - Integer prefix = Helper.parseInt(net[1]); + Integer prefix = ip.startsWith("ip4:") ? 32 : 64; + if (net.length == 2) + prefix = Helper.parseInt(net[1]); if (prefix == null) continue; if (ConnectionHelper.inSubnet(text, net[0], prefix)) {