0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-04 21:08:57 +01:00

ircd::fs: Check IOV_MAX limits for make_iov().

This commit is contained in:
Jason Volk 2018-12-01 15:21:06 -08:00
parent 24e031a810
commit 2dc36775a8

View file

@ -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) =