Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Dec 2022 20:12:11 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ccd8c4488afb - main - linuxkpi: seq_read: Fix off by one error
Message-ID:  <202212212012.2BLKCBaY012094@gitrepo.freebsd.org>

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

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

commit ccd8c4488afb15c2b866b58d5aa9dd994f300f95
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-12-21 11:42:24 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-12-21 20:11:31 +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
---
 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?202212212012.2BLKCBaY012094>