0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::allocator::je: Ensure truncation of mallctl results.

This commit is contained in:
Jason Volk 2020-05-29 15:44:28 -07:00
parent 6eb54341ef
commit 2e5a4daf76

View file

@ -82,7 +82,7 @@ ircd::allocator::get(const string_view &key_,
syscall(::mallctl, key, data(buf), &len, nullptr, 0UL);
return string_view
{
data(buf), len
data(buf), std::min(len, size(buf))
};
}
#endif
@ -100,7 +100,7 @@ ircd::allocator::set(const string_view &key_,
syscall(::mallctl, key, data(cur), &curlen, const_cast<char *>(data(val)), size(val));
return string_view
{
data(cur), curlen
data(cur), std::min(curlen, size(cur))
};
}
#endif