Fix off-by-one
Before accessing array member, check whether it is not out of valid range. Detected with ASan + RUMPKERNEL.
This commit is contained in:
parent
7946929d7b
commit
05ac20bb1c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sp_common.c,v 1.39 2016/09/05 20:41:59 dholland Exp $ */
|
||||
/* $NetBSD: sp_common.c,v 1.40 2020/03/24 01:13:41 kamil Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
|
||||
|
@ -342,7 +342,7 @@ dosend(struct spclient *spc, struct iovec *iov, size_t iovlen)
|
|||
}
|
||||
|
||||
/* ok, need to adjust iovec for potential next round */
|
||||
while (n >= (ssize_t)iov[0].iov_len && iovlen) {
|
||||
while (iovlen && n >= (ssize_t)iov[0].iov_len) {
|
||||
n -= iov[0].iov_len;
|
||||
iov++;
|
||||
iovlen--;
|
||||
|
|
Loading…
Reference in New Issue