From afa00abb2b68205bee539d7947130d6b1b1ec6e9 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 1 Apr 2021 19:39:14 +0200 Subject: Hardened entire system By using the nonnull attribute and replace buffer-overflow-prone functions like strcpy, strcat and sprintf by strlcpy, strlcat and snprintf. --- libs/libc/inc/def.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'libs/libc/inc/def.h') diff --git a/libs/libc/inc/def.h b/libs/libc/inc/def.h index e71c502..378a4d0 100644 --- a/libs/libc/inc/def.h +++ b/libs/libc/inc/def.h @@ -30,11 +30,17 @@ typedef unsigned long long u64; #define ABS(a) ((u32)(((s32)(a) < 0) ? (-a) : (a))) -#define NORETURN __attribute__((noreturn)) -#define DEPRECATED __attribute__((deprecated)) -#define NO_SANITIZE __attribute__((no_sanitize("undefined"))) -#define PACKED __attribute__((packed)) -#define ALIGNED(align) __attribute__((aligned(align))) +#define ATTR __attribute__ +#define NORETURN ATTR((noreturn)) +#define DEPRECATED ATTR((deprecated)) +#define NONNULL ATTR((nonnull)) +#define PURE ATTR((pure)) +#define CONST ATTR((const)) +#define FLATTEN ATTR((flatten)) +#define PACKED ATTR((packed)) +#define HOT ATTR((hot)) +#define ALIGNED(align) ATTR((aligned(align))) +#define NO_SANITIZE ATTR((no_sanitize("undefined"))) #define EOF (-1) #define NULL ((void *)0) -- cgit v1.2.3