diff options
Diffstat (limited to 'include/wchar.h')
| -rw-r--r-- | include/wchar.h | 13 |
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 | ||
| 19 | static inline __attribute__ ((always_inline)) | ||
| 20 | wchar_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 | ||
