Bladeren bron

[Minor] RDNS: Filter starting and trailing dots in DNS names

tags/1.9.0
Vsevolod Stakhov 5 jaren geleden
bovenliggende
commit
a0b6284734
1 gewijzigde bestanden met toevoegingen van 27 en 0 verwijderingen
  1. 27
    0
      contrib/librdns/resolver.c

+ 27
- 0
contrib/librdns/resolver.c Bestand weergeven

return NULL; return NULL;
} }


if (cur_name[0] == '.') {
/* Skip dots at the begin */
unsigned int ndots = strspn (cur_name, ".");

cur_name += ndots;
clen -= ndots;

if (clen == 0) {
rdns_warn ("got empty name to resolve");
rdns_request_free (req);
return NULL;
}
}

if (cur_name[clen - 1] == '.') {
/* Skip trailing dots */
while (clen >= 1 && cur_name[clen - 1] == '.') {
clen --;
}

if (clen == 0) {
rdns_warn ("got empty name to resolve");
rdns_request_free (req);
return NULL;
}
}

if (last_name == NULL && queries == 1 && clen < MAX_FAKE_NAME) { if (last_name == NULL && queries == 1 && clen < MAX_FAKE_NAME) {
/* We allocate structure in the static space */ /* We allocate structure in the static space */
idx = (struct rdns_fake_reply_idx *)align_ptr (fake_buf, 16); idx = (struct rdns_fake_reply_idx *)align_ptr (fake_buf, 16);

Laden…
Annuleren
Opslaan