mirror of
https://github.com/git/git.git
synced 2024-11-28 04:23:30 +08:00
60d198d022
In cc8fdaee1e
(banned.h: mark sprintf() as banned, 2018-07-24), both
'sprintf()' and 'vsprintf()' were marked as banned functions. The
non-variadic macro to ban 'vsprintf' has a typo which says that
'sprintf', not 'vsprintf' is banned. The variadic version does not have
the same typo.
Fix this by updating the explicit form of 'vsprintf' as the banned
version of itself, not 'sprintf'.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
33 lines
796 B
C
33 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 */
|