o Fix a couple off-by-one errors, style(9).

This commit is contained in:
Maxim Konovalov 2006-04-15 20:00:35 +00:00
parent baaa487753
commit 6e14f80bcc
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=27560

View file

@ -513,10 +513,10 @@ echo_write(struct cdev *dev, struct uio *uio, int ioflag)
/* Copy the string in from user memory to kernel memory */
err = copyin(uio->uio_iov->iov_base, echomsg->msg,
MIN(uio->uio_iov->iov_len,BUFFERSIZE));
MIN(uio->uio_iov->iov_len, BUFFERSIZE - 1));
/* Now we need to null terminate, then record the length */
*(echomsg->msg + MIN(uio->uio_iov->iov_len,BUFFERSIZE)) = 0;
*(echomsg->msg + MIN(uio->uio_iov->iov_len, BUFFERSIZE - 1)) = 0;
echomsg->len = MIN(uio->uio_iov->iov_len, BUFFERSIZE);
if (err != 0) {