<feed xmlns='http://www.w3.org/2005/Atom'>
<title>fortify-headers/tests/test_wcsnrtombs_static.c, branch master</title>
<subtitle>Standalone portable header-based implementation of FORTIFY_SOURCE=3 
</subtitle>
<id>http://git.dustri.org/fortify-headers/atom?h=master</id>
<link rel='self' href='http://git.dustri.org/fortify-headers/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/'/>
<updated>2026-05-04T15:02:12Z</updated>
<entry>
<title>Add a handful of tests</title>
<updated>2026-05-04T15:02:12Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2026-05-04T15:02:12Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=f6b4a6e6feae6c6f4dfeecfd04363163ba4d7098'/>
<id>urn:sha1:f6b4a6e6feae6c6f4dfeecfd04363163ba4d7098</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix a bug in wcsnrtombs</title>
<updated>2026-04-30T15:42:29Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2026-04-30T15:42:29Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=f9239e2c0f0be9856322727887a45333683940a6'/>
<id>urn:sha1:f9239e2c0f0be9856322727887a45333683940a6</id>
<content type='text'>
__d is a char * destination buffer, so __b is already the byte capacity.
Dividing by sizeof(wchar_t) makes no sense here, it was likely copy-pasted
from mbsnrtowcs (where the destination is wchar_t *). The first branch also
fails to limit __n (the byte write cap) to __b, so overflows are possible when
a wide character produces multi-byte output. The second branch (else) correctly
limits __n to __b.

This commit replaces the broken two-branch logic with the simple correct
pattern matching wcsrtombs, and adds two tests two prove that nothing broke.
</content>
</entry>
</feed>
