1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

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.
This commit is contained in:
Tor Egge 2002-10-20 18:43:11 +00:00
parent 8f9628a126
commit 0a676b7eb6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105538

View File

@ -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;