提交 83789105 编写于 作者: P Peter Maydell 提交者: Michael Roth

linux-user: make bogus negative iovec lengths fail EINVAL

If the guest passes us a bogus negative length for an iovec, fail
EINVAL rather than proceeding blindly forward. This fixes some of
the error cases tests for readv and writev in the LTP.
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: NRichard Henderson <rth@twiddle.net>
Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
(cherry picked from commit dfae8e00)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 7a238b9f
......@@ -1776,7 +1776,7 @@ static struct iovec *lock_iovec(int type, abi_ulong target_addr,
errno = 0;
return NULL;
}
if (count > IOV_MAX) {
if (count < 0 || count > IOV_MAX) {
errno = EINVAL;
return NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册