aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/spf.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-07 22:52:55 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-07 22:52:55 +0100
commit2e5dae850516f923cda3b26492c697a676aa3cdc (patch)
tree9e1c685d5a0f3c3eb89c363e9a6d190cc1c6dc53 /src/libserver/spf.c
parent6691508e4221b4efd89653f0a8ee49996446904e (diff)
downloadrspamd-2e5dae850516f923cda3b26492c697a676aa3cdc.tar.gz
rspamd-2e5dae850516f923cda3b26492c697a676aa3cdc.zip
[Minor] More bounds checks
Diffstat (limited to 'src/libserver/spf.c')
-rw-r--r--src/libserver/spf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index dc8e2b36c..fdd4a5136 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -452,6 +452,9 @@ spf_check_ptr_host (struct spf_dns_cb *cb, const char *name)
if (*dend == '.') {
dend--;
}
+ if (nend <= nstart || dend <= dstart) {
+ return FALSE;
+ }
/* Now compare from end to start */
for (;;) {
@@ -459,6 +462,7 @@ spf_check_ptr_host (struct spf_dns_cb *cb, const char *name)
msg_debug_spf ("ptr records mismatch: %s and %s", dend, nend);
return FALSE;
}
+
if (dend == dstart) {
break;
}
@@ -469,7 +473,8 @@ spf_check_ptr_host (struct spf_dns_cb *cb, const char *name)
nend--;
dend--;
}
- if (nend != nstart && *(nend - 1) != '.') {
+
+ if (nend > nstart && *(nend - 1) != '.') {
/* Not a subdomain */
return FALSE;
}