summaryrefslogtreecommitdiff
path: root/include (follow)
AgeCommit message (Collapse)Author
2024-06-15Fix some pointer-arithmetic warningsjvoisin
This should fix the second part of #59
2024-06-14Remove `restrict` keywordsjvoisin
- They're not used anywhere else in fortify-headers - It's breaking compilation on C++, because compatibility is hard It was initially reported on https://gitlab.alpinelinux.org/alpine/aports/-/issues/16200
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-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
2024-01-13Properly check for builtinsjvoisin
Clang's [documentation](https://clang.llvm.org/docs/LanguageExtensions.html#has-builtin) says: > __has_builtin should not be used to detect support for a builtin macro; use #ifdef instead. So we're now using both, since it's often tedious/non-trivial to find out what is a macro and what is a compiler builtin, across compilers and C versions.
2023-12-28Re-enable previously disabled overlap checksjvoisin
They were previously disabled in 80a83a5
2023-12-27Improve __fh_overlap implementationjvoisin
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-18fix typo for __builtin_memcpypsykose
2023-12-16Disable str(r)chr hardeningq66
It's UB to subtract null pointers, which these potentially may be. It also makes python test suite fail.
2023-12-15Rename some macros to be more namespace-friendlyq66
2023-12-15Fix missing } for extern "C" when using clangq66
2023-12-15Move wctomb to stdlib.h and disable it for nowq66
2023-12-15Guard some conditional stdio APIs with the right macrosq66
Fixes https://github.com/jvoisin/fortify-headers/issues/34
2023-12-15Do not use static inline for C++ to avoid ODR violationsq66
Fixes https://github.com/jvoisin/fortify-headers/issues/31
2023-12-15Add missing include in select.hq66
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-12-06Work around an erroneous `-Wformat-nonliteral` bug in gccjvoisin
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110834 Reported-by: ksperling-apple
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-16Add a check about redefined macrosjvoisin
2023-10-01Add vfprintf`jvoisin
2023-10-01Add `fprintf`jvoisin
2023-09-30Add `vprintf`jvoisin
2023-09-30Fix a typojvoisin
2023-09-30Add `strlen`jvoisin
2023-09-29Make use of the native _chk variants for realjvoisin
2023-09-28Add `printf` hardeningjvoisin
2023-09-27Add support for more builtin compiler provided _chk variantsjvoisin
2023-09-27Add an option to make use of compiler-provided _chk builtinsjvoisin
2023-09-22Add more __diagnose_as_builtin annotationsjvoisin
2023-09-21Properly enable diagnose_as_builtin attributejvoisin
2023-09-20Add tests for compile-time errorsjvoisin
2023-09-20Replace a strlen+condition with strnlenjvoisin
2023-09-11Factorize overlap checks into a macrojvoisin
2023-09-11Add a warning for _FORTIFY_SOURCE>3jvoisin
2023-09-11Add a warning if realpath is called with path set to NULLjvoisin
2023-09-11Add the warn_unused_result attribute to alloc-related functionsjvoisin
2023-08-22Clean up some includesjvoisin
- Remove a superfluous `#if defined(__has_builtin)` since it's already accounted for in include/fortify-headers.h - Replace `_FORTIFY_FD_POS0` with the already existing `_FORTIFY_POS0` - Factorise some duplicate code into a macro
2023-08-22Increase portabilityjvoisin
If the compiler doesn't know about `__builtin_trap`, use `abort` instead.
2023-08-22Add hardening for pwritejvoisin
2023-08-21Harden umaskjvoisin
2023-08-21Make use of __diagnose_ifjvoisin
2023-08-21Remove some todo in __bmo's implementationjvoisin
2023-08-21Add tests for fgetws and mbsrtowcsjvoisin