lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230927110219.b5n3fbbwrxtcwtzp@box.shutemov.name>
Date:   Wed, 27 Sep 2023 14:02:19 +0300
From:   kirill.shutemov@...ux.intel.com
To:     Binbin Wu <binbin.wu@...ux.intel.com>
Cc:     dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
        shuah@...nel.org, linux-kselftest@...r.kernel.org, x86@...nel.org,
        linux-kernel@...r.kernel.org, weihong.zhang@...el.com
Subject: Re: [PATCH] selftests/x86/lam: Zero out buffer for readlink()

On Sun, Sep 24, 2023 at 07:33:46AM +0800, Binbin Wu wrote:
> Zero out the buffer for readlink() since readlink() does not append a
> terminating null byte to the buffer.
> 
> Fixes: 833c12ce0f430 ("selftests/x86/lam: Add inherit test cases for linear-address masking")
> 
> Signed-off-by: Binbin Wu <binbin.wu@...ux.intel.com>
> ---
>  tools/testing/selftests/x86/lam.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c
> index eb0e46905bf9..9f06942a8e25 100644
> --- a/tools/testing/selftests/x86/lam.c
> +++ b/tools/testing/selftests/x86/lam.c
> @@ -680,7 +680,7 @@ static int handle_execve(struct testcases *test)
>  		perror("Fork failed.");
>  		ret = 1;
>  	} else if (pid == 0) {
> -		char path[PATH_MAX];
> +		char path[PATH_MAX] = {0};

Shouldn't it be PATH_MAX+1 to handle the case when readlink(2) stores
exactly PATH_MAX bytes into the buffer?

>  
>  		/* Set LAM mode in parent process */
>  		if (set_lam(lam) != 0)
> 
> base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70
> -- 
> 2.25.1
> 

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ