From 0a676b7eb6a0985d12bfe664fe4ef486dab0509f Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Sun, 20 Oct 2002 18:43:11 +0000 Subject: [PATCH] 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. --- sys/dev/rp/rp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 148267a76631..56a8d6bf87c9 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;