lkml.org 
[lkml]   [2015]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86, cpuinfo x86_model_id whitespace cleanup
On Tue, May 19, 2015 at 11:44:41AM -0700, Andy Lutomirski wrote:
> On May 19, 2015 11:13 AM, "Borislav Petkov" <bp@alien8.de> wrote:
> >
> > On Tue, May 19, 2015 at 01:25:59PM -0400, Brian Gerst wrote:
> > > Using strlcpy in this manner could fail if it does larger than byte
> > > copies and they overlap.
> >
> > Why?
> >
> > AFAICT, strlcpy() calls memcpy() and memcpy should handle overlapping
> > buffers just fine.
>
> Are you thinking of memmove?

I guess I'm trying to find out why don't we have a BIG FAT WARNING over
memcpy saying not to use it with overlapping buffers and larger than
byte sizes. Or maybe this is something everyone, except me, just knows
and that's a "Doh, Boris, of course!".

Btw, can we still avoid using the temporary buffer and use strncpy()
instead? AFAICT, that does byte copies, from looking at the asm.

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--


\
 
 \ /
  Last update: 2015-05-19 21:41    [W:0.076 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site