summaryrefslogtreecommitdiff
path: root/include/wchar.h
diff options
context:
space:
mode:
authorsin2015-03-04 20:16:44 +0000
committersin2015-03-04 20:16:44 +0000
commitc51977cfcc0b4d62e4836b4471f760ec3e3936e9 (patch)
tree66e9189f392010f22bbb5da230fa7e191db4bd35 /include/wchar.h
parent4ddbe16d881bb8ea70f63ea55f92fa5bb4c7802d (diff)
Fix wcsrtombs() check
Diffstat (limited to 'include/wchar.h')
-rw-r--r--include/wchar.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/wchar.h b/include/wchar.h
index 78485c0..916e91a 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -147,10 +147,12 @@ __fortify_wcsrtombs(char *d, const wchar_t **s, size_t n,
147 mbstate_t *st) 147 mbstate_t *st)
148{ 148{
149 size_t bos = __builtin_object_size(d, 0); 149 size_t bos = __builtin_object_size(d, 0);
150 size_t r;
150 151
151 if (n > bos) 152 r = wcsrtombs(d, s, n > bos ? bos : n, st);
153 if (bos < n && d && *s && r != (size_t)-1)
152 __builtin_trap(); 154 __builtin_trap();
153 return wcsrtombs(d, s, n, st); 155 return r;
154} 156}
155 157
156static inline __attribute__ ((always_inline)) 158static inline __attribute__ ((always_inline))