mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-04 02:16:46 +00:00
feat(userspace): Add BAN_ALTERNATIVE
macro to banned.h
.
BAN_ALTERNATIVE is same as BAN but the message also provides an alternative function that the user could use instead of the banned function. Fixes #1035 Signed-off-by: Vaibhav <vrongmeal@gmail.com>
This commit is contained in:
parent
1c80c1f458
commit
7ed3e1d927
@ -21,14 +21,18 @@ limitations under the License.
|
|||||||
// function is used.
|
// function is used.
|
||||||
#define BAN(function) using_##function##_is_banned
|
#define BAN(function) using_##function##_is_banned
|
||||||
|
|
||||||
|
// BAN_ALTERNATIVE is same as BAN but the message also provides an alternative
|
||||||
|
// function that the user could use instead of the banned function.
|
||||||
|
#define BAN_ALTERNATIVE(function, alternative) using_##function##_is_banned__use_##alternative##_instead
|
||||||
|
|
||||||
#undef strcpy
|
#undef strcpy
|
||||||
#define strcpy(a, b) BAN(strcpy)
|
#define strcpy(a, b) BAN(strcpy)
|
||||||
|
|
||||||
#undef vsprintf
|
#undef vsprintf
|
||||||
#define vsprintf(a, b, c) BAN(vsprintf)
|
#define vsprintf(a, b, c) BAN_ALTERNATIVE(vsprintf, vsnprintf)
|
||||||
|
|
||||||
#undef sprintf
|
#undef sprintf
|
||||||
#define sprintf(a, b, ...) BAN(sprintf)
|
#define sprintf(a, b, ...) BAN_ALTERNATIVE(sprintf, snprintf)
|
||||||
|
|
||||||
#undef strcat
|
#undef strcat
|
||||||
#define strcat(a, b) BAN(strcat)
|
#define strcat(a, b) BAN(strcat)
|
||||||
@ -40,7 +44,7 @@ limitations under the License.
|
|||||||
#define strncpy(a, b, c) BAN(strncpy)
|
#define strncpy(a, b, c) BAN(strncpy)
|
||||||
|
|
||||||
#undef swprintf
|
#undef swprintf
|
||||||
#define swprintf(a, b, c, ...) BAN(swprintf)
|
#define swprintf(a, b, c, ...) BAN_ALTERNATIVE(swprintf, snprintf)
|
||||||
|
|
||||||
#undef vswprintf
|
#undef vswprintf
|
||||||
#define vswprintf(a, b, c, d) BAN(vswprintf)
|
#define vswprintf(a, b, c, d) BAN_ALTERNATIVE(vswprintf, vsnprintf)
|
||||||
|
Loading…
Reference in New Issue
Block a user