git: 19956b44dcfd - stable/13 - linuxkpi: seq_read: Fix off by one error
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Feb 2023 11:14:35 UTC
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)