git: d6ccce0aa267 - main - linux(4): readlink should fail if bufzis <= 0.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 31 Mar 2022 18:21:55 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=d6ccce0aa267db8ee57736e944520e2967896340 commit d6ccce0aa267db8ee57736e944520e2967896340 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-03-31 18:21:41 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-03-31 18:21:41 +0000 linux(4): readlink should fail if bufzis <= 0. MFC after: 2 weeks --- 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,