diff options
Diffstat (limited to 'include/wchar.h')
| -rw-r--r-- | include/wchar.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/wchar.h b/include/wchar.h index 9e5413f..78485c0 100644 --- a/include/wchar.h +++ b/include/wchar.h | |||
| @@ -41,10 +41,13 @@ __fortify_mbsrtowcs(wchar_t *d, const char **s, | |||
| 41 | size_t wn, mbstate_t *st) | 41 | size_t wn, mbstate_t *st) |
| 42 | { | 42 | { |
| 43 | size_t bos = __builtin_object_size(d, 0); | 43 | size_t bos = __builtin_object_size(d, 0); |
| 44 | size_t r; | ||
| 44 | 45 | ||
| 45 | if (wn > bos / sizeof(wchar_t)) | 46 | bos /= sizeof(wchar_t); |
| 47 | r = mbsrtowcs(d, s, wn > bos ? bos : wn, st); | ||
| 48 | if (bos < wn && d && *s && r != (size_t)-1) | ||
| 46 | __builtin_trap(); | 49 | __builtin_trap(); |
| 47 | return mbsrtowcs(d, s, wn, st); | 50 | return r; |
| 48 | } | 51 | } |
| 49 | 52 | ||
| 50 | static inline __attribute__ ((always_inline)) | 53 | static inline __attribute__ ((always_inline)) |
