summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/wchar.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/wchar.h b/include/wchar.h
index fe2bcfc..54df2be 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -16,8 +16,21 @@ __fortify_fgetws(wchar_t *s, int n, FILE *fp)
16 return fgetws(s, n, fp); 16 return fgetws(s, n, fp);
17} 17}
18 18
19static inline __attribute__ ((always_inline))
20wchar_t *
21__fortify_wmemset(wchar_t *s, wchar_t c, size_t n)
22{
23 size_t bos = __builtin_object_size(s, 0);
24
25 if (n > bos / sizeof(wchar_t))
26 __builtin_trap();
27 return wmemset(s, c, n);
28}
29
19#undef fgetws 30#undef fgetws
20#define fgetws(s, n, fp) __fortify_fgetws(s, n, fp) 31#define fgetws(s, n, fp) __fortify_fgetws(s, n, fp)
32#undef wmemset
33#define wmemset(s, c, n) __fortify_wmemset(s, c, n)
21 34
22#endif 35#endif
23 36