mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
ng_tty: avoid the sign extention of char
When c is compared to sc->hotchar, both undergo integer promotion, which can lead to c being sign extended. Fix this by casting c to an unsigned char. Reviewed by: kevans MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D54544
This commit is contained in:
parent
0b298e314a
commit
9b2478f60b
1 changed files with 2 additions and 1 deletions
|
|
@ -489,7 +489,8 @@ ngt_rint(struct tty *tp, char c, int flags)
|
|||
m->m_pkthdr.len++;
|
||||
|
||||
/* Ship off mbuf if it's time */
|
||||
if (sc->hotchar == -1 || c == sc->hotchar || m->m_len >= MHLEN) {
|
||||
if (sc->hotchar == -1 || (u_char)c == sc->hotchar ||
|
||||
m->m_len >= MHLEN) {
|
||||
sc->m = NULL;
|
||||
NG_SEND_DATA_ONLY(error, sc->hook, m); /* Will queue */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue