fortify-headers

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

commit f3c9815580f7e2684a7f517a4e656f13e4347e77
parent 5ce4b94b7ac1d529b42ac76609b686d1ba0dffcb
Author: jvoisin <julien.voisin@dustri.org>
Date:   Mon, 11 Sep 2023 17:55:38 +0200

Add a warning if realpath is called with path set to NULL

Diffstat:
Minclude/stdlib.h | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/include/stdlib.h b/include/stdlib.h @@ -80,6 +80,7 @@ _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) #if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__) #undef realpath __diagnose_as_builtin(__builtin_realpath, 1, 2) +__warning_if(__p == NULL, "'realpath' called with path set to `NULL`; did you invert the arguments?") _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) { #ifndef PATH_MAX