aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc/mem.h
diff options
context:
space:
mode:
authorMarvin Borner2021-04-01 19:39:14 +0200
committerMarvin Borner2021-04-01 19:39:14 +0200
commitafa00abb2b68205bee539d7947130d6b1b1ec6e9 (patch)
tree3a821a75af6c4d4ff1bd4128c4859d77abf87e66 /libs/libc/inc/mem.h
parent4c168fb34c15a1b8981abef7ccef1542a6fb05ca (diff)
Hardened entire system
By using the nonnull attribute and replace buffer-overflow-prone functions like strcpy, strcat and sprintf by strlcpy, strlcat and snprintf.
Diffstat (limited to 'libs/libc/inc/mem.h')
-rw-r--r--libs/libc/inc/mem.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/libs/libc/inc/mem.h b/libs/libc/inc/mem.h
index ec00628..2d55eff 100644
--- a/libs/libc/inc/mem.h
+++ b/libs/libc/inc/mem.h
@@ -5,8 +5,8 @@
#include <def.h>
-void *malloc_debug(u32 size, const char *file, int line, const char *func, const char *inp);
-void free_debug(void *ptr, const char *file, int line, const char *func, const char *inp);
+void *malloc_debug(u32 size, const char *file, int line, const char *func, const char *inp) NONNULL;
+void free_debug(void *ptr, const char *file, int line, const char *func, const char *inp) NONNULL;
#define malloc(size) malloc_debug((u32)(size), __FILE__, __LINE__, __func__, #size)
#define free(ptr) free_debug((void *)(ptr), __FILE__, __LINE__, __func__, #ptr)
void *realloc(void *ptr, u32 size);
@@ -20,10 +20,10 @@ void *zalloc(u32 size);
#error "No lib target specified. Please use -Dkernel or -Duserspace"
#endif
-void *memcpy(void *dest, const void *src, u32 n);
-void *memset(void *dest, int val, u32 n);
-void *memchr(void *src, int c, u32 n);
-int memcmp(const void *s1, const void *s2, u32 n);
-int mememp(const u8 *buf, u32 n);
+void *memcpy(void *dest, const void *src, u32 n) NONNULL;
+void *memset(void *dest, u32 val, u32 n) NONNULL;
+void *memchr(void *src, char c, u32 n) NONNULL;
+int memcmp(const void *s1, const void *s2, u32 n) NONNULL;
+int mememp(const u8 *buf, u32 n) NONNULL;
#endif