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:	f697b9432d ("linuxkpi: drm-kmod debugfs support")
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37771
This commit is contained in:
Emmanuel Vadot 2022-12-21 12:42:24 +01:00
parent 2e08e4b75e
commit ccd8c4488a

View File

@ -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)