strtok behaviour when uninitialized

Joseph Myers joseph@codesourcery.com
Mon Feb 12 17:22:00 GMT 2018


On Mon, 12 Feb 2018, Ondøej Bílka wrote:

> > (I'd make an exception for memory copies: I think those should _all_
> > be defined by us to behave as-if by calling memmove().  Yes, really.
> > Yes, including memcpy.)
> >
> for copy abort is better, as it isn't clear if programer knew what he
> was doing and he should use memmove if he checked that overlap is ok.

In any case, we should keep the case of copying memory to itself - memcpy 
with the same source and destination address - working without any such 
abort (as far as I know that always does work in practice and compilers 
may sometimes generate such calls implicitly, so any checks disallowing 
self-copies should be limited to aggressive checking modes and only copies 
explicitly written by the user, not compiler-generated ones).  (Bug 16004 
asks for checks for overlapping copies.)

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list