linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Richter <rric@kernel.org>
To: Len Baker <len.baker@gmx.com>
Cc: Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@alien8.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	linux-hardening@vger.kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drivers/edac/edac_mc: Remove all strcpy() uses
Date: Mon, 2 Aug 2021 11:52:06 +0200	[thread overview]
Message-ID: <YQfARq44bAIR/HEi@rric.localdomain> (raw)
In-Reply-To: <YQe4n5H00g3xhSbQ@rric.localdomain>

On 02.08.21 11:19:33, Robert Richter wrote:
> 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);

Another note: Other parts of the code use 'len' instead of 'left', so
if you could change that too?

Thanks,

-Robert

> >  				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);
> >  		}
> > 

      reply	other threads:[~2021-08-02  9:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-01 14:35 [PATCH v2] drivers/edac/edac_mc: Remove all strcpy() uses Len Baker
2021-08-02  9:19 ` Robert Richter
2021-08-02  9:52   ` Robert Richter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YQfARq44bAIR/HEi@rric.localdomain \
    --to=rric@kernel.org \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=keescook@chromium.org \
    --cc=len.baker@gmx.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).