0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd::rfc1035: Case transform to lower in make_name().

This commit is contained in:
Jason Volk 2019-08-02 21:59:08 -07:00
parent 3dfb593dec
commit d9a770ba3e

View file

@ -433,6 +433,7 @@ ircd::rfc1035::make_name(const mutable_buffer &out,
*pos = '\0'; *pos = '\0';
ircd::tokens(fqdn, '.', [&pos, &out](const string_view &label) ircd::tokens(fqdn, '.', [&pos, &out](const string_view &label)
{ {
thread_local char labelbuf[LABEL_MAX+1];
if(unlikely(size(label) > LABEL_MAX)) if(unlikely(size(label) > LABEL_MAX))
throw error throw error
{ {
@ -442,7 +443,12 @@ ircd::rfc1035::make_name(const mutable_buffer &out,
*pos++ = size(label); *pos++ = size(label);
*pos = '\0'; *pos = '\0';
pos += strlcpy(pos, label, std::distance(pos, end(out))); pos += strlcpy
{
pos,
tolower(labelbuf, label),
std::distance(pos, end(out))
};
}); });
// The null terminator is included in the returned buffer view // The null terminator is included in the returned buffer view