mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::fs: Check IOV_MAX limits for make_iov().
This commit is contained in:
parent
24e031a810
commit
2dc36775a8
1 changed files with 18 additions and 0 deletions
18
ircd/fs.cc
18
ircd/fs.cc
|
@ -1141,6 +1141,15 @@ namespace ircd::fs
|
|||
ircd::vector_view<const struct ::iovec>
|
||||
ircd::fs::make_iov(const mutable_buffers &bufs)
|
||||
{
|
||||
if(unlikely(bufs.size() > IOV_MAX))
|
||||
throw error
|
||||
{
|
||||
make_error_code(std::errc::invalid_argument),
|
||||
"Buffer count of %zu excheeds IOV_MAX of %zu",
|
||||
bufs.size(),
|
||||
IOV_MAX
|
||||
};
|
||||
|
||||
size_t i(0);
|
||||
for(; i < bufs.size(); ++i)
|
||||
_iov_.at(i) =
|
||||
|
@ -1157,6 +1166,15 @@ ircd::fs::make_iov(const mutable_buffers &bufs)
|
|||
ircd::vector_view<const struct ::iovec>
|
||||
ircd::fs::make_iov(const const_buffers &bufs)
|
||||
{
|
||||
if(unlikely(bufs.size() > IOV_MAX))
|
||||
throw error
|
||||
{
|
||||
make_error_code(std::errc::invalid_argument),
|
||||
"Buffer count of %zu excheeds IOV_MAX of %zu",
|
||||
bufs.size(),
|
||||
IOV_MAX
|
||||
};
|
||||
|
||||
size_t i(0);
|
||||
for(; i < bufs.size(); ++i)
|
||||
_iov_.at(i) =
|
||||
|
|
Loading…
Reference in a new issue