This is the mail archive of the
mailing list for the glibc project.
Re: strtok behaviour when uninitialized
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Ondřej Bílka <neleai at seznam dot cz>
- Cc: Zack Weinberg <zackw at panix dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 12 Feb 2018 16:44:43 +0000
- Subject: Re: strtok behaviour when uninitialized
- Authentication-results: sourceware.org; auth=none
- References: <20180211181954.l5qkzway7zkd3345@salil> <email@example.com> <20180211185345.jqcfijuchzkowkcx@salil> <firstname.lastname@example.org> <CAKCAbMiqEo+3YZJeyKKCQgJPvL4cWcLo32V7J5sOmqyUw8qj0Q@mail.gmail.com> <20180212075112.GA24316@domone>
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