fortify-headers

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

commit c4d9299abf7f6b941493fc487d2ccbb47d756479
parent 9014b0266147dbb74d5d9e6e2c24ae9d21ad7e07
Author: jvoisin <julien.voisin@dustri.org>
Date:   Wed, 10 Jul 2024 16:46:15 +0200

Fix access annotation for stpncpy/strncpy

The dsize parameter is the length of the dst,
not the length of the src.

Reported-by: ncopa

Diffstat:
Minclude/string.h | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/string.h b/include/string.h @@ -198,7 +198,7 @@ _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) #undef stpncpy __fh_access(write_only, 1) -__fh_access(read_only, 2, 3) +__fh_access(read_only, 2) #if __has_builtin(__builtin_stpncpy) __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) #endif @@ -304,7 +304,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, } __fh_access (write_only, 1) -__fh_access (read_only, 2, 3) +__fh_access (read_only, 2) #if __has_builtin(__builtin_strncpy) __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) #endif