The branch main has been updated by manu:

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

commit ccd8c4488afb15c2b866b58d5aa9dd994f300f95
Author:     Emmanuel Vadot <[email protected]>
AuthorDate: 2022-12-21 11:42:24 +0000
Commit:     Emmanuel Vadot <[email protected]>
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)

Reply via email to