f4609b896f
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
32 lines
796 B
C
32 lines
796 B
C
#ifndef BANNED_H
|
|
#define BANNED_H
|
|
|
|
/*
|
|
* This header lists functions that have been banned from our code base,
|
|
* because they're too easy to misuse (and even if used correctly,
|
|
* complicate audits). Including this header turns them into compile-time
|
|
* errors.
|
|
*/
|
|
|
|
#define BANNED(func) sorry_##func##_is_a_banned_function
|
|
|
|
#undef strcpy
|
|
#define strcpy(x,y) BANNED(strcpy)
|
|
#undef strcat
|
|
#define strcat(x,y) BANNED(strcat)
|
|
#undef strncpy
|
|
#define strncpy(x,y,n) BANNED(strncpy)
|
|
#undef strncat
|
|
#define strncat(x,y,n) BANNED(strncat)
|
|
|
|
#undef sprintf
|
|
#undef vsprintf
|
|
#ifdef HAVE_VARIADIC_MACROS
|
|
#define sprintf(...) BANNED(sprintf)
|
|
#define vsprintf(...) BANNED(vsprintf)
|
|
#else
|
|
#define sprintf(buf,fmt,arg) BANNED(sprintf)
|
|
#define vsprintf(buf,fmt,arg) BANNED(vsprintf)
|
|
#endif
|
|
|
|
#endif /* BANNED_H */
|