0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::rfc1035: Fix any uninitialized gaps in the name buffer.

This commit is contained in:
Jason Volk 2018-04-28 18:47:17 -07:00
parent 12146cd39a
commit 6d771191fc

View file

@ -353,6 +353,7 @@ ircd::rfc1035::make_name(const mutable_buffer &out,
{
assert(!empty(out));
char *pos{data(out)};
*pos = '\0';
ircd::tokens(fqdn, '.', [&pos, &out](const string_view &label)
{
if(unlikely(size(label) >= 64))
@ -362,6 +363,7 @@ ircd::rfc1035::make_name(const mutable_buffer &out,
};
*pos++ = size(label);
*pos = '\0';
pos += strlcpy(pos, label, std::distance(pos, end(out)));
});