From e819a3c7346f8395168c3693e91b37d74c5585af Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 1 Jul 2015 16:43:16 +0800 Subject: [PATCH] client: return EINVAL if iovcnt < 0 for p{read,write}v() Signed-off-by: Kefu Chai --- src/client/Client.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index 28fefb610c8..4e70756d4c0 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7131,6 +7131,8 @@ int Client::read(int fd, char *buf, loff_t size, loff_t offset) int Client::preadv(int fd, const struct iovec *iov, int iovcnt, loff_t offset) { + if (iovcnt < 0) + return EINVAL; return _preadv_pwritev(fd, iov, iovcnt, offset, false); } @@ -7458,6 +7460,8 @@ int Client::write(int fd, const char *buf, loff_t size, loff_t offset) int Client::pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset) { + if (iovcnt < 0) + return EINVAL; return _preadv_pwritev(fd, iov, iovcnt, offset, true); } -- 2.47.3