From: Alan T. DeKok Date: Tue, 30 Dec 2025 12:05:34 +0000 (-0500) Subject: ban strncpy() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ac69fa15d972b42423cd3d70e73e57525eac43b;p=thirdparty%2Ffreeradius-server.git ban strncpy() --- diff --git a/src/include/build.h b/src/include/build.h index 67158d193ad..0fd4b3cc7dc 100644 --- a/src/include/build.h +++ b/src/include/build.h @@ -510,3 +510,10 @@ do { \ do { \ _type ignored UNUSED = (_expr); \ } while (0) + +/** Force a compilation error if strncpy() is used. + * + */ +extern char *dont_use_strncpy(char *dst, char const *src, size_t len); +#undef strncpy +#define strncpy(_dst, _src, _len) dont_use_strncpy()