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:
parent
6eb54341ef
commit
2e5a4daf76
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue