DragonFlyBSD Kernel Audit
DF-0098 / fix.diff
← back to finding ↓ download raw
diff --git a/kern/subr_sglist.c b/kern/subr_sglist.c
--- a/kern/subr_sglist.c
+++ b/kern/subr_sglist.c
@@ -399,7 +399,7 @@
 		pmap = NULL;
 
 	error = 0;
-	while (resid > 0 && uio->uio_resid) {
+	while (resid > 0 && uio->uio_resid && uio->uio_iovcnt > 0) {
 		iov = uio->uio_iov;
 		len = iov->iov_len;
 		if (len == 0) {