[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRD6uoVYwCSFN0U0@rric.localdomain>
Date: Mon, 9 Aug 2021 11:51:54 +0200
From: Robert Richter <rric@...nel.org>
To: Len Baker <len.baker@....com>
Cc: Borislav Petkov <bp@...en8.de>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Tony Luck <tony.luck@...el.com>,
James Morse <james.morse@....com>,
Kees Cook <keescook@...omium.org>,
linux-hardening@...r.kernel.org, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] drivers/edac/edac_mc: Remove all strcpy() uses
On 07.08.21 17:59:57, Len Baker wrote:
> @@ -1113,11 +1115,11 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
> p = e->label;
> *p = '\0';
> } else {
> - if (p != e->label) {
> - strcpy(p, OTHER_LABEL);
> - p += strlen(OTHER_LABEL);
> - }
> - strcpy(p, dimm->label);
> + const char *text = (p != e->label) ? OTHER_LABEL :
> + dimm->label;
> +
> + strscpy(p, text, len);
> + len -= strlen(p);
The logic looks broken and dimm labels are not properly copied (the
code should add an " or " separator between labels).
-Robert
> p += strlen(p);
> }
>
Powered by blists - more mailing lists