lkml.org 
[lkml]   [2021]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] drivers/edac/edac_mc: Remove all strcpy() uses
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);
> > }
> >

\
 
 \ /
  Last update: 2021-08-02 11:52    [W:0.038 / U:4.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site