another range check

This commit is contained in:
Omar Polo 2024-06-10 08:24:16 +00:00
parent 4a2e39c23b
commit 0965162959
1 changed files with 8 additions and 2 deletions

View File

@ -119,8 +119,14 @@ match_host(struct vhost *v, struct client *c)
if (addr == NULL)
return 0;
if (*c->domain == '\0')
strlcpy(c->domain, addr->pp, sizeof(c->domain));
if (*c->domain == '\0') {
if (strlcpy(c->domain, addr->pp, sizeof(c->domain))
>= sizeof(c->domain)) {
log_warnx("%s: domain too long: %s", __func__,
addr->pp);
*c->domain = '\0';
}
}
if (matches(v->domain, c->domain))
return 1;