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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 2 Aug 2021 11:19:27 +0200
From:   Robert Richter <rric@...nel.org>
To:     Len Baker <len.baker@....com>
Cc:     Kees Cook <keescook@...omium.org>, Borislav Petkov <bp@...en8.de>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Tony Luck <tony.luck@...el.com>,
        James Morse <james.morse@....com>,
        linux-hardening@...r.kernel.org, linux-edac@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] drivers/edac/edac_mc: Remove all strcpy() uses

On 01.08.21 16:35:58, Len Baker wrote:

> @@ -1114,10 +1116,12 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
>  			*p = '\0';
>  		} else {
>  			if (p != e->label) {
> -				strcpy(p, OTHER_LABEL);
> +				strscpy(p, OTHER_LABEL, left);
> +				left -= strlen(OTHER_LABEL);
>  				p += strlen(OTHER_LABEL);

Those both must be strlen(p) now as otherwise 'left' could underflow
(and p overflow).

-Robert

>  			}
> -			strcpy(p, dimm->label);
> +			strscpy(p, dimm->label, left);
> +			left -= strlen(p);
>  			p += strlen(p);
>  		}
> 

Powered by blists - more mailing lists