summaryrefslogtreecommitdiff
path: root/include/strings.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/strings.h')
-rw-r--r--include/strings.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/strings.h b/include/strings.h
index e81c8e0..d9a625d 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -21,8 +21,22 @@ __fortify_bcopy(const void *__restrict src, void *__restrict dest, size_t n)
21 return bcopy(src, dest, n); 21 return bcopy(src, dest, n);
22} 22}
23 23
24static inline __attribute__ ((always_inline))
25void
26__fortify_bzero(void *src, size_t n)
27{
28 size_t bos = __builtin_object_size(src, 0);
29
30 if (n > bos)
31 __builtin_trap();
32 return bzero(src, n);
33}
34
24#undef bcopy 35#undef bcopy
25#define bcopy(src, dest, n) __fortify_bcopy(src, dest, n) 36#define bcopy(src, dest, n) __fortify_bcopy(src, dest, n)
37#undef bzero
38#define bzero(src, n) __fortify_bzero(src, n)
39
26#endif 40#endif
27 41
28#endif 42#endif