aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-11-25 12:41:46 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-11-25 19:36:41 +0000
commit67218bcea847c93ccd002335748884b02a3ca807 (patch)
tree0d9c016a64b4cddf23e9938600be133a37a3515d
parent31784ee1e37dc0337637493721c4c9b98547089b (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.c2
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: