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` */
nstart = name;
nend = nstart + strlen (nstart) - 1;
- if (nend == nstart || dend == dstart) {
+ if (nend <= nstart || dend <= dstart) {
return FALSE;
}
/* Strip last '.' from names */