Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2024 01:46:18 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 057da12eeaa6 - stable/14 - kern___realpathat(): do not copyout past end of string
Message-ID:  <202412020146.4B21kIdN026576@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=057da12eeaa6700793340ffcfede620135b7f540

commit 057da12eeaa6700793340ffcfede620135b7f540
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-11-25 12:41:46 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-02 01:44:55 +0000

    kern___realpathat(): do not copyout past end of string
    
    (cherry picked from commit 67218bcea847c93ccd002335748884b02a3ca807)
---
 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 d48c1c0be80a..aa6141cb0230 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -3203,7 +3203,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?202412020146.4B21kIdN026576>