strtok behaviour when uninitialized
Salil Kapur
salilkapur93@gmail.com
Sun Feb 11 19:07:00 GMT 2018
On Sun, Feb 11, 2018 at 07:39:50PM +0100, Andreas Schwab wrote:
> On Feb 11 2018, Salil Kapur <salilkapur93@gmail.com> wrote:
>
> > Would it make sense to add a NULL check and not let strtok throw a
> > segfault?
>
> No. This is undefined behaviour, and a crash is a valid and somewhat
> appropriate reaction.
I get that. Why keep it undefined? Even after adding the check it would
still be backwards compatible.
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
More information about the Libc-alpha
mailing list