From f3c9815580f7e2684a7f517a4e656f13e4347e77 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 11 Sep 2023 17:55:38 +0200 Subject: Add a warning if realpath is called with path set to NULL --- include/stdlib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/stdlib.h b/include/stdlib.h index 2671280..1a92bff 100644 --- 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 -- cgit v1.3