This is the mail archive of the
mailing list for the glibc project.
Re: strtok behaviour when uninitialized
On Mon, Feb 12, 2018 at 04:44:43PM +0000, Joseph Myers wrote:
> 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.)
it wouldn't that hard to do details as its edge case, we could add in c
generic function, say memcpy_overlap to decide how to hadle it.