git: 67218bcea847 - main - kern___realpathat(): do not copyout past end of string
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Nov 2024 19:36:48 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=67218bcea847c93ccd002335748884b02a3ca807 commit 67218bcea847c93ccd002335748884b02a3ca807 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-11-25 12:41:46 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-11-25 19:36:41 +0000 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 --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: