Check for constructed name in --srv-host exceeding length limit.

Thanks to Mikhail Dmitrichenko for spotting this.
This commit is contained in:
Simon Kelley
2025-07-15 15:15:32 +01:00
parent 2b844b8c83
commit c9342cb556

View File

@@ -6262,6 +6262,8 @@ void read_opts(int argc, char **argv, char *compile_opts)
strchr(srv->name, '.') && strchr(srv->name, '.') &&
strchr(srv->name, '.') == strrchr(srv->name, '.')) strchr(srv->name, '.') == strrchr(srv->name, '.'))
{ {
if (strlen(srv->name) + 1 + strlen(daemon->domain_suffix) > MAXDNAME)
die(_("srv-host name %s too long after domain appended"), srv->name, EC_MISC);
strcpy(buff, srv->name); strcpy(buff, srv->name);
strcat(buff, "."); strcat(buff, ".");
strcat(buff, daemon->domain_suffix); strcat(buff, daemon->domain_suffix);