<feed xmlns='http://www.w3.org/2005/Atom'>
<title>fortify-headers/include/string.h, branch strn</title>
<subtitle>Standalone portable header-based implementation of FORTIFY_SOURCE=3 
</subtitle>
<id>http://git.dustri.org/fortify-headers/atom?h=strn</id>
<link rel='self' href='http://git.dustri.org/fortify-headers/atom?h=strn'/>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/'/>
<updated>2024-10-10T13:50:40Z</updated>
<entry>
<title>Fix a crash in strncpy/stpncpy</title>
<updated>2024-10-10T13:50:40Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-10-10T13:50:40Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=e2cfd2879a15db00dfa9a42eeb1baaef6a930aff'/>
<id>urn:sha1:e2cfd2879a15db00dfa9a42eeb1baaef6a930aff</id>
<content type='text'>
```
Core was generated by `scripts/mod/modpost -M -m -o Module.symvers -n -T modules.order vmlinux.o'.
Program terminated with signal SIGSEGV, Segmentation fault.
warning: 17     src/string/strlen.c: No such file or directory
(gdb) bt
```

&gt; I think strncpy logic is broken: `__fh_size_t max_len_s = strlen(__s);` may try read past `size_t __n`.
&gt; Create a buf without any trailing `\0`, do `strncpy(dest, buf, sizeof(buf));`, it should work, since `strncpy` will stop at `sizeof buf`
&gt; but the current fority-headers implementation will do `strlen(buf)`, which will go boom when it is not terminated with \0

Reported-by: ncopa
</content>
</entry>
<entry>
<title>Fix usage of strnlen</title>
<updated>2024-10-03T22:16:50Z</updated>
<author>
<name>Quentin Rameau</name>
</author>
<published>2024-10-02T19:15:12Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=6573631a5e4339a2fc2f86680e36e35e25bf416c'/>
<id>urn:sha1:6573631a5e4339a2fc2f86680e36e35e25bf416c</id>
<content type='text'>
As with previous commit, some strnlen calls
where introduced in 22a8094, but not reverted.

As strnlen isn't part of C standard,
this was breaking C builds.
</content>
</entry>
<entry>
<title>Revert d2594298b89d0fb8989cae3ebc8900e77b6aa478</title>
<updated>2024-09-02T14:11:06Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-09-02T14:08:38Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=114b563adc2b942bc5abd4c5820507076d453f64'/>
<id>urn:sha1:114b563adc2b942bc5abd4c5820507076d453f64</id>
<content type='text'>
As reported on irc:

```
17:51 &lt;q&gt; jvoisin, fortify-headers seems to be broken (on Alpine at least)
17:52 &lt;q&gt; Repeating the message from over-there:
17:52 &lt;q&gt; /usr/include/fortify/string.h: In function 'strncat':
17:52 &lt;q&gt; /usr/include/fortify/string.h:297:36: error: implicit declaration of function 'strnlen'; did you mean 'strlen'? [-Wimplicit-function-declaration]
17:52 &lt;q&gt; This is with a simple file that includes string.h and call strncat, built with c99 -O1 f.c
```
</content>
</entry>
<entry>
<title>Fix access annotation for stpncpy/strncpy</title>
<updated>2024-07-10T14:46:15Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-07-10T14:46:15Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=c4d9299abf7f6b941493fc487d2ccbb47d756479'/>
<id>urn:sha1:c4d9299abf7f6b941493fc487d2ccbb47d756479</id>
<content type='text'>
The dsize parameter is the length of the dst,
not the length of the src.

Reported-by: ncopa
</content>
</entry>
<entry>
<title>prefix special defines with FORTIFY_</title>
<updated>2024-07-10T13:20:23Z</updated>
<author>
<name>psykose</name>
</author>
<published>2024-07-10T04:49:02Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=459d202b1bbf7abb817a596ce9374edfb7b4da8f'/>
<id>urn:sha1:459d202b1bbf7abb817a596ce9374edfb7b4da8f</id>
<content type='text'>
just in case, and because 'PEDANTIC_CHECKS' is a really generic name
</content>
</entry>
<entry>
<title>Fix some overlap mismatch</title>
<updated>2024-04-24T15:14:46Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-04-24T15:09:08Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=a817e1555a755224cacc1cbdeeaefb6a1de606f0'/>
<id>urn:sha1:a817e1555a755224cacc1cbdeeaefb6a1de606f0</id>
<content type='text'>
This was caught by the following test:

```

int main(void) {
    char c[32];
    memcpy(c, c + 16, 16);
}
```

Reported-by: q66
</content>
</entry>
<entry>
<title>Disable pedantic checks by default</title>
<updated>2024-04-24T12:51:19Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-04-24T12:49:52Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=265fa03fa0c467c9c41d803ebe2a538e758cba20'/>
<id>urn:sha1:265fa03fa0c467c9c41d803ebe2a538e758cba20</id>
<content type='text'>
They can be re-enabled via `PEDANTIC_CHECKS`
</content>
</entry>
<entry>
<title>Relax our checks for memchr on C11 and above</title>
<updated>2024-03-19T17:35:13Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-03-19T17:35:13Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=8ed72e7c1caa0eb4238e649063c26a11720935de'/>
<id>urn:sha1:8ed72e7c1caa0eb4238e649063c26a11720935de</id>
<content type='text'>
Since C11:

&gt; This function behaves as if it reads the bytes sequentially and stops as soon
as a matching bytes is found: if the array pointed to by ptr is smaller than
count, but the match is found within the array, the behavior is well-defined.

Reported-by: q66
</content>
</entry>
<entry>
<title>Add some NULL-pointers checks</title>
<updated>2024-03-08T15:28:52Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2024-03-08T15:07:57Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=140cffbe84a08669d67c3257258d2bb70ff29c3b'/>
<id>urn:sha1:140cffbe84a08669d67c3257258d2bb70ff29c3b</id>
<content type='text'>
See:
- https://www.imperialviolet.org/2016/06/26/nonnull.html
- https://davidben.net/2024/01/15/empty-slices.html
</content>
</entry>
<entry>
<title>Re-enable previously disabled overlap checks</title>
<updated>2023-12-28T15:13:37Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2023-12-27T16:07:32Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=22a8094b41b2606084dc0c0c70487e5ed0fcb652'/>
<id>urn:sha1:22a8094b41b2606084dc0c0c70487e5ed0fcb652</id>
<content type='text'>
They were previously disabled in 80a83a5
</content>
</entry>
</feed>
