Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 19:38:55 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: aeddbb898e1a - stable/13 - linux(4): readlink should fail if bufzis <= 0.
Message-ID:  <202206171938.25HJctVS015330@gitrepo.freebsd.org>

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

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

commit aeddbb898e1a14ece7f467d222be1604e5857b27
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-03-31 18:21:41 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:48 +0000

    linux(4): readlink should fail if bufzis <= 0.
    
    MFC after:              2 weeks
    
    (cherry picked from commit d6ccce0aa267db8ee57736e944520e2967896340)
---
 sys/compat/linux/linux_file.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 6a1402c09456..8926e760fc39 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1042,6 +1042,9 @@ linux_readlink(struct thread *td, struct linux_readlink_args *args)
 	char *name;
 	int error;
 
+	if (args->count <= 0)
+		return (EINVAL);
+
 	if (!LUSECONVPATH(td)) {
 		return (kern_readlinkat(td, AT_FDCWD, args->name, UIO_USERSPACE,
 		    args->buf, UIO_USERSPACE, args->count));
@@ -1060,6 +1063,9 @@ linux_readlinkat(struct thread *td, struct linux_readlinkat_args *args)
 	char *name;
 	int error, dfd;
 
+	if (args->bufsiz <= 0)
+		return (EINVAL);
+
 	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
 	if (!LUSECONVPATH(td)) {
 		return (kern_readlinkat(td, dfd, args->path, UIO_USERSPACE,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171938.25HJctVS015330>