summaryrefslogtreecommitdiff
path: root/tests (follow)
AgeCommit message (Collapse)Author
2024-10-21Neuter an issue in strncat2.3.3jvoisin
`strlen(src)` isn't guaranteed to be valid.
2024-10-10Fix a crash in strncpy/stpncpystrnjvoisin
``` 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 ``` > I think strncpy logic is broken: `__fh_size_t max_len_s = strlen(__s);` may try read past `size_t __n`. > Create a buf without any trailing `\0`, do `strncpy(dest, buf, sizeof(buf));`, it should work, since `strncpy` will stop at `sizeof buf` > but the current fority-headers implementation will do `strlen(buf)`, which will go boom when it is not terminated with \0 Reported-by: ncopa
2024-10-10Disable snprintf/sprintf hardening for now2.3.2jvoisin
2024-10-08Run various C versions in the CIjvoisin
2024-09-06Work around a gcc warningjvoisin
It seems that annotating sprintf with `write` makes gcc unhappy, as its analyser is unable to understand that we're checking if `__b != -1` before calling `__orig_snprintf`, so let's comment this annotation for now.
2024-07-10prefix special defines with FORTIFY_psykose
just in case, and because 'PEDANTIC_CHECKS' is a really generic name
2024-06-21Add a test for C++ compilationjvoisin
2024-06-15Fix some pointer-arithmetic warningsjvoisin
This should fix the second part of #59
2024-05-26Add vasprintf/asprintf2.3jvoisin
The only hardening being done here is to set the char** parameter to thos functions to NULL in case of an error, to prevent it from being used should people forget to check return values. This is already done on some BSD, as well as in Rocky Linux.
2024-04-24Add a testjvoisin
2024-04-24Fix some overlap mismatchjvoisin
This was caught by the following test: ``` int main(void) { char c[32]; memcpy(c, c + 16, 16); } ``` Reported-by: q66
2024-04-24Disable pedantic checks by defaultjvoisin
They can be re-enabled via `PEDANTIC_CHECKS`
2024-03-19Relax our checks for memchr on C11 and above2.2jvoisin
Since C11: > 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
2024-03-08Add some NULL-pointers checksjvoisin
See: - https://www.imperialviolet.org/2016/06/26/nonnull.html - https://davidben.net/2024/01/15/empty-slices.html
2023-12-28Re-enable previously disabled overlap checksjvoisin
They were previously disabled in 80a83a5
2023-12-27Don't check for overlapping in strncpy/stpncpy for nowjvoisin
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
2023-12-16Ditto for strrchrq66
2023-12-16Disable strchr tests since strchr hardening is disabledq66
2023-12-16Also handle SIGTRAP in testsq66
SIGILL is not the only possible trap handler. On non-x86 archs this is not the case for instance.
2023-12-15Remove superfluous includesjvoisin
This should fix #32
2023-12-07Add qsortjvoisin
2023-12-07Add a global test to ensure that all headers are compilingjvoisin
2023-11-16Add hardening for select()jvoisin
This is unlikely to be used, since fd_set is usually manipulated by macros, but it doesn't hurt to add a simple comparison.
2023-11-01Add support for FD_ISSETjvoisin
2023-10-01Add vfprintf`jvoisin
2023-10-01Add `fprintf`jvoisin
2023-09-30Add `vprintf`jvoisin
2023-09-30Add `strlen`jvoisin
2023-09-29Make use of the native _chk variants for realjvoisin
2023-09-28Add `printf` hardeningjvoisin
2023-09-20Add tests for compile-time errorsjvoisin
2023-09-17Make use of the buffers in the wide-chars testsjvoisin
Just in case the compiler tries to optimize some things away.
2023-09-17Fix compilation under clang for bsd-specific functionsjvoisin
2023-09-17Add more dynamic testsjvoisin
2023-09-17Add dynamic tests for strcpy and strncatjvoisin
2023-09-17Add a test for stpcpyjvoisin
2023-09-11Fix a warningjvoisin
2023-09-11Add a bunch of wchar_t testsjvoisin
2023-09-04Add tests for wmemcpyjvoisin
2023-08-26Add two tests for wmemmovejvoisin
2023-08-22Show the failing file name in the testsuitejvoisin
2023-08-22Add hardening for pwritejvoisin
2023-08-22Add tests for wmemsetjvoisin
2023-08-21Add tests for mbstowcsjvoisin
2023-08-21Harden umaskjvoisin
2023-08-21Add tests for fgetws and mbsrtowcsjvoisin
2023-08-20Remove the testsuite from the coverage datajvoisin
2023-08-20Split build and runjvoisin
Both in the CI, and in the Makefile
2023-08-20Fix clang buildjvoisin
- s/CLFAGS/CFLAGS/ - provide paths to local includes - sprinkle more __pass_object_size__ - remove a problematic test
2023-08-20Fix some sizeof-related typoes in the testsuitejvoisin