mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
linuxkpi: Update posittion after copy in seq_read()
`seq_read()` is usually called in a loop because the destination buffer might be smaller than the source. The caller relies on the updated position to read what is next. We also use `memcpy()` instead of `strscpy()` because we don't need to append a NUL character. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51560
This commit is contained in:
parent
7cbc4d8759
commit
f0e4459126
1 changed files with 3 additions and 6 deletions
|
|
@ -64,13 +64,10 @@ 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 + 1);
|
||||
memcpy(ubuf, sbuf_data(sbuf) + *ppos, size);
|
||||
*ppos += size;
|
||||
|
||||
/* add 1 for null terminator */
|
||||
if (rc > 0)
|
||||
rc += 1;
|
||||
|
||||
return (rc);
|
||||
return (size);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Reference in a new issue