Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2025 16:57:56 GMT
From:      Ahmad Khalifa <vexeduxr@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e05521121f05 - main - ng_tty: copy to the correct mbuf
Message-ID:  <202509251657.58PGvujh079555@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by vexeduxr:

URL: https://cgit.FreeBSD.org/src/commit/?id=e05521121f05a1b1e0d7c7b5fbe79f83fc303cd0

commit e05521121f05a1b1e0d7c7b5fbe79f83fc303cd0
Author:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
AuthorDate: 2025-09-25 16:54:28 +0000
Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
CommitDate: 2025-09-25 16:55:28 +0000

    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
---
 sys/netgraph/ng_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c
index c7d8a1b64eac..0e3230a66f66 100644
--- a/sys/netgraph/ng_tty.c
+++ b/sys/netgraph/ng_tty.c
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509251657.58PGvujh079555>