Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Feb 2023 11:14:35 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 19956b44dcfd - stable/13 - linuxkpi: seq_read: Fix off by one error
Message-ID:  <202302021114.312BEZVe076681@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by manu:

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

commit 19956b44dcfd6aadc096cd167e975f02a3804964
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-12-21 11:42:24 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-02-02 11:10:37 +0000

    linuxkpi: seq_read: Fix off by one error
    
    strscpy needs the buffer length not the string length (so including
    the '\0').
    
    Reviewed by:    bz
    Fixes:  f697b9432d9c ("linuxkpi: drm-kmod debugfs support")
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D37771
    
    (cherry picked from commit ccd8c4488afb15c2b866b58d5aa9dd994f300f95)
---
 sys/compat/linuxkpi/common/src/linux_seq_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c
index c358e4ae7dc1..d4d8ef059ac4 100644
--- a/sys/compat/linuxkpi/common/src/linux_seq_file.c
+++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c
@@ -67,7 +67,7 @@ seq_read(struct linux_file *f, char *ubuf, size_t size, off_t *ppos)
 		return (-EINVAL);
 
 	size = min(rc - *ppos, size);
-	rc = strscpy(ubuf, sbuf_data(sbuf) + *ppos, size);
+	rc = strscpy(ubuf, sbuf_data(sbuf) + *ppos, size + 1);
 
 	/* add 1 for null terminator */
 	if (rc > 0)



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