Browse Source

[Minor] Add some more boundaries checks

tags/1.5.5
Vsevolod Stakhov 7 years ago
parent
commit
722c4939c0
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      src/libserver/spf.c

+ 5
- 5
src/libserver/spf.c View File

@@ -424,17 +424,17 @@ spf_check_ptr_host (struct spf_dns_cb *cb, const char *name)
const char *dend, *nend, *dstart, *nstart;
struct spf_record *rec = cb->rec;

if (name == NULL) {
return FALSE;
}
if (cb->ptr_host != NULL) {
dstart = cb->ptr_host;

}
else {
dstart = cb->resolved->cur_domain;
}

if (name == NULL || dstart == NULL) {
return FALSE;
}

msg_debug_spf ("check ptr %s vs %s", name, dstart);

/* We need to check whether `cur_domain` is a subdomain for `name` */
@@ -442,7 +442,7 @@ spf_check_ptr_host (struct spf_dns_cb *cb, const char *name)
nstart = name;
nend = nstart + strlen (nstart) - 1;

if (nend == nstart || dend == dstart) {
if (nend <= nstart || dend <= dstart) {
return FALSE;
}
/* Strip last '.' from names */

Loading…
Cancel
Save