From: stefan Date: Mon, 28 Jul 2008 06:13:22 +0000 (+0000) Subject: Fix integer truncation in ttwrite(). ok deraadt, miod. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dd02b3da6888066d9a55bf4a18395b4ed9344bd0;p=openbsd Fix integer truncation in ttwrite(). ok deraadt, miod. --- diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 99d69d1f281..e7d82f5f68e 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.76 2008/05/23 16:42:03 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.77 2008/07/28 06:13:22 stefan Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -1667,7 +1667,8 @@ ttwrite(struct tty *tp, struct uio *uio, int flag) u_char *cp = NULL; int cc, ce, obufcc = 0; struct proc *p; - int i, hiwat, cnt, error, s; + int i, hiwat, error, s; + size_t cnt; u_char obuf[OBUFSIZ]; hiwat = tp->t_hiwat; @@ -1732,7 +1733,7 @@ loop: * leftover from last time. */ if (cc == 0) { - cc = min(uio->uio_resid, OBUFSIZ); + cc = MIN(uio->uio_resid, OBUFSIZ); cp = obuf; error = uiomove(cp, cc, uio); if (error) {