o Fix a couple off-by-one errors, style(9).
This commit is contained in:
parent
baaa487753
commit
6e14f80bcc
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=27560
1 changed files with 8 additions and 8 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue