ng_tty: copy to the correct mbuf

memcpy should copy to the current mbuf, otherwise we're copying to the
first mbuf in the chain over and over.

Reported by:	kevans
Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52713
This commit is contained in:
Ahmad Khalifa
2025-09-25 19:54:28 +03:00
parent 904ac13eed
commit e05521121f
+1 -1
View File
@@ -427,7 +427,7 @@ ngt_rint_bypass(struct tty *tp, const void *buf, size_t len)
for (mb = m; mb != NULL; mb = mb->m_next) {
length = min(M_TRAILINGSPACE(mb), len - total);
memcpy(mtod(m, char *), (const char *)buf + total, length);
memcpy(mtod(mb, char *), (const char *)buf + total, length);
mb->m_len = length;
total += length;
m->m_pkthdr.len += length;