Date: Mon, 25 Nov 2024 19:36:48 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 67218bcea847 - main - kern___realpathat(): do not copyout past end of string Message-ID: <202411251936.4APJamMe042141@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411251936.4APJamMe042141>