<feed xmlns='http://www.w3.org/2005/Atom'>
<title>fortify-headers/tests/test_strncpy_overwrite_under.c, branch experimental</title>
<subtitle>Standalone portable header-based implementation of FORTIFY_SOURCE=3 
</subtitle>
<id>http://git.dustri.org/fortify-headers/atom?h=experimental</id>
<link rel='self' href='http://git.dustri.org/fortify-headers/atom?h=experimental'/>
<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>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>
<entry>
<title>Don't check for overlapping in strncpy/stpncpy for now</title>
<updated>2023-12-27T15:06:59Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2023-12-27T11:36:47Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=80a83a56b52e833e6d3afec4d0723d7625d52cee'/>
<id>urn:sha1:80a83a56b52e833e6d3afec4d0723d7625d52cee</id>
<content type='text'>
They check overlap across the whole range of the given length, but
the given length is not what will actually be copied, rather it's
the maximum length (if src is shorter, only length of src will be
copied). This triggers false positives and traps where it shouldn't
(e.g. in ICU tests).

Reported-by: q66
</content>
</entry>
<entry>
<title>Add tests for strncpy and handle overlapping buffers there</title>
<updated>2023-06-14T12:59:11Z</updated>
<author>
<name>jvoisin</name>
</author>
<published>2023-06-14T12:59:11Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=cb1ce9e1815a492de0f13c2b046b8472024b9f6d'/>
<id>urn:sha1:cb1ce9e1815a492de0f13c2b046b8472024b9f6d</id>
<content type='text'>
</content>
</entry>
</feed>
