https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117023

--- Comment #5 from Bruno Haible <bruno at clisp dot org> ---
(In reply to Jakub Jelinek from comment #4)
> I think it is just fine to call strncat (s, NULL, 0); because it will
> read no more than 0 characters from src, but I think it is problematic to
> call strncat (NULL, s, 0);
> or strncat (NULL, NULL, 0); because it can't always append the null
> character to that.

I agree, because the standard talks about "the string pointed to by s1", and
that implies that s1 is already NUL-terminated before strncat is called.

Likewise for wcsncat; see
https://sourceware.org/bugzilla/show_bug.cgi?id=32286#c2 .

Reply via email to