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

ircd::json: Ensure space for null string terminator in print().

This commit is contained in:
Jason Volk 2018-03-20 13:52:19 -07:00
parent 6e7751eaf3
commit 2a539cb22c

View file

@ -125,9 +125,14 @@ ircd::json::print(const mutable_buffer &buf,
if(unlikely(!size(buf)))
return 0;
mutable_buffer out
{
data(buf), size(buf) - 1
};
const auto sv
{
stringify(mutable_buffer{buf}, std::forward<T>(t)...)
stringify(out, std::forward<T>(t)...)
};
assert(sv.size() < size(buf));