fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit 4988174f7eecc6da544ebf23156ce638cecf0f3f
parent 3067c28ceb744b2bafe9202023084f762871e844
Author: jvoisin <julien.voisin@dustri.org>
Date:   Fri, 29 Sep 2023 14:50:24 +0200

Make use of the native _chk variants for real

Diffstat:
M.github/workflows/testsuite.yaml | 4----
Minclude/stdio.h | 4++--
Mtests/Makefile | 2+-
3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/testsuite.yaml b/.github/workflows/testsuite.yaml @@ -31,10 +31,6 @@ jobs: run: | sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.version }} 100 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.version }} 100 - - name: Build with native chk - if: ${{ matrix.use_native_chk == true }} - shell: bash - run: make CFLAGS=-DUSE_NATIVE_CHK -C tests gcc - name: Build without native chk, and run the testsuite if: ${{ matrix.use_native_chk == false }} shell: bash diff --git a/include/stdio.h b/include/stdio.h @@ -147,7 +147,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, const char *__f, __builtin_va_list __v) { #if __has_builtin(__builtin___vsnprintf_chk) && USE_NATIVE_CHK - return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v,); + return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v); #else size_t __b = __bos(__s, 0); @@ -167,7 +167,7 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, __builtin_va_list __v) { #if __has_builtin(__builtin___vsprintf_chk) && USE_NATIVE_CHK - return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v,); + return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v); #else size_t __b = __bos(__s, 0); int __r; diff --git a/tests/Makefile b/tests/Makefile @@ -1,4 +1,4 @@ -CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 +CFLAGS+=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 COMPTIME_TARGETS= \ test_memcpy_overwrite_under \