diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2024-11-25 12:41:46 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2024-11-25 19:36:41 +0000 |
| commit | 67218bcea847c93ccd002335748884b02a3ca807 (patch) | |
| tree | 0d9c016a64b4cddf23e9938600be133a37a3515d | |
| parent | 31784ee1e37dc0337637493721c4c9b98547089b (diff) | |
kern___realpathat(): do not copyout past end of string
Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D47739
| -rw-r--r-- | sys/kern/vfs_cache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index c4b4d59f3b40..f7178ee006ea 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3290,7 +3290,7 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, &freebuf, &size); } if (error == 0) { - error = copyout(retbuf, buf, size); + error = copyout(retbuf, buf, min(strlen(retbuf) + 1, size)); free(freebuf, M_TEMP); } out: |
