summaryrefslogtreecommitdiffstats
path: root/sys/dev/rp
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2002-10-20 18:43:11 +0000
committertegge <tegge@FreeBSD.org>2002-10-20 18:43:11 +0000
commit8516a6e929bc4bf91699d6c494f1e117c7a6ca00 (patch)
tree3f3a13d6ccb60e9c566b2e7953ea02992bab3e0a /sys/dev/rp
parent78bcfbf6c016f6dce82220e21ede3e9db4130db7 (diff)
downloadFreeBSD-src-8516a6e929bc4bf91699d6c494f1e117c7a6ca00.zip
FreeBSD-src-8516a6e929bc4bf91699d6c494f1e117c7a6ca00.tar.gz
Fix data corruption caused by last byte in oddly sized transfers being read
to wrong location in RxBuf and written from wrong location in TxBuf.
Diffstat (limited to 'sys/dev/rp')
-rw-r--r--sys/dev/rp/rp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c
index 148267a..56a8d6b 100644
--- a/sys/dev/rp/rp.c
+++ b/sys/dev/rp/rp.c
@@ -695,7 +695,7 @@ static _INLINE_ void rp_do_receive(struct rp_port *rp, struct tty *tp,
rp_readmultich2(cp,sGetTxRxDataIO(cp),(u_int16_t *)rp->RxBuf,wRecv);
}
if ( ToRecv & 1 ) {
- rp->RxBuf[(ToRecv-1)] = (u_char) rp_readch1(cp,sGetTxRxDataIO(cp));
+ ((unsigned char *)rp->RxBuf)[(ToRecv-1)] = (u_char) rp_readch1(cp,sGetTxRxDataIO(cp));
}
tk_nin += ToRecv;
tk_rawcc += ToRecv;
@@ -1644,7 +1644,8 @@ rpstart(tp)
rp_writemultich2(cp, sGetTxRxDataIO(cp), (u_int16_t *)rp->TxBuf, wcount);
}
if ( count & 1 ) {
- rp_writech1(cp, sGetTxRxDataIO(cp), rp->TxBuf[(count-1)]);
+ rp_writech1(cp, sGetTxRxDataIO(cp),
+ ((unsigned char *)(rp->TxBuf))[(count-1)]);
}
}
rp->rp_restart = (qp->c_cc > 0) ? rp->rp_fifo_lw : 0;
OpenPOWER on IntegriCloud