Lasse Collin wrote:
> By the way, it seems the check in m4/wcsncat.m4 fails on multiple
> platforms due to the same issue that is described in m4/strncat.m4 on
> Solaris where strncat can dereference n+1 bytes. See the second
> while-loop condition in OpenBSD's wcsncat[2]. ...
> In FreeBSD it was fixed in 2016.[4]
> 
> [2] 
> https://cvsweb.openbsd.org/checkout/src/lib/libc/string/wcsncat.c,v?rev=1.4
> [4] 
> https://github.com/freebsd/freebsd-src/commit/cd3dbc2573cd943a968260679a48ffca39080ceb

You may gain some kudos by Theo de Raadt by reporting this to the OpenBSD
people...

> So even if one didn't
> care about the N3322 behavior at all, the N3322 check in m4/wcsncat.m4
> is still useful.

Good to know. Let's document it.


2026-08-16  Bruno Haible  <[email protected]>

        doc: Mention a wcsncat bug.
        Reported by Lasse Collin in
        <https://lists.gnu.org/archive/html/bug-gnulib/2026-08/msg00213.html>.
        * doc/posix-functions/wcsncat.texi: Mention a wcsncat bug.

diff --git a/doc/posix-functions/wcsncat.texi b/doc/posix-functions/wcsncat.texi
index 28cbe049f4..389fcb2c83 100644
--- a/doc/posix-functions/wcsncat.texi
+++ b/doc/posix-functions/wcsncat.texi
@@ -10,6 +10,9 @@
 Portability problems fixed by Gnulib:
 @itemize
 @item
+This function dereferences too much memory on some platforms:
+NetBSD 10.0, OpenBSD 7.6.
+@item
 This function does not support zero-length operations on NULL pointers
 on some platforms:
 macOS 15, NetBSD 10.0, OpenBSD 7.6, Solaris 11.4, Cygwin 3.5.4.




Reply via email to