mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::rfc1035: Fix any uninitialized gaps in the name buffer.
This commit is contained in:
parent
12146cd39a
commit
6d771191fc
1 changed files with 2 additions and 0 deletions
|
@ -353,6 +353,7 @@ ircd::rfc1035::make_name(const mutable_buffer &out,
|
||||||
{
|
{
|
||||||
assert(!empty(out));
|
assert(!empty(out));
|
||||||
char *pos{data(out)};
|
char *pos{data(out)};
|
||||||
|
*pos = '\0';
|
||||||
ircd::tokens(fqdn, '.', [&pos, &out](const string_view &label)
|
ircd::tokens(fqdn, '.', [&pos, &out](const string_view &label)
|
||||||
{
|
{
|
||||||
if(unlikely(size(label) >= 64))
|
if(unlikely(size(label) >= 64))
|
||||||
|
@ -362,6 +363,7 @@ ircd::rfc1035::make_name(const mutable_buffer &out,
|
||||||
};
|
};
|
||||||
|
|
||||||
*pos++ = size(label);
|
*pos++ = size(label);
|
||||||
|
*pos = '\0';
|
||||||
pos += strlcpy(pos, label, std::distance(pos, end(out)));
|
pos += strlcpy(pos, label, std::distance(pos, end(out)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue