Commit dfae8e00 authored by Peter Maydell's avatar Peter Maydell Committed by Riku Voipio
Browse files

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: default avatarPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: default avatarRichard Henderson <rth@twiddle.net>
Signed-off-by: default avatarRiku Voipio <riku.voipio@linaro.org>
parent 63ec54d7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
    }