1 /* Checking macros for wchar functions.
2 Copyright (C) 2005-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19 #ifndef _WCHAR_H
20 # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead."
21 #endif
22
23
24 extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1,
25 const wchar_t *__restrict __s2, size_t __n,
26 size_t __ns1) __THROW;
27 extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias,
28 (wchar_t *__restrict __s1,
29 const wchar_t *__restrict __s2, size_t __n),
30 wmemcpy);
31 extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn,
32 (wchar_t *__restrict __s1,
33 const wchar_t *__restrict __s2, size_t __n,
34 size_t __ns1), __wmemcpy_chk)
35 __warnattr ("wmemcpy called with length bigger than size of destination "
36 "buffer");
37
38 __fortify_function wchar_t *
__NTH(wmemcpy (wchar_t * __restrict __s1,const wchar_t * __restrict __s2,size_t __n))39 __NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
40 size_t __n))
41 {
42 return __glibc_fortify_n (wmemcpy, __n, sizeof (wchar_t),
43 __glibc_objsize0 (__s1),
44 __s1, __s2, __n);
45 }
46
47
48 extern wchar_t *__wmemmove_chk (wchar_t *__s1, const wchar_t *__s2,
49 size_t __n, size_t __ns1) __THROW;
50 extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1,
51 const wchar_t *__s2,
52 size_t __n), wmemmove);
53 extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn,
54 (wchar_t *__s1, const wchar_t *__s2,
55 size_t __n, size_t __ns1), __wmemmove_chk)
56 __warnattr ("wmemmove called with length bigger than size of destination "
57 "buffer");
58
59 __fortify_function wchar_t *
__NTH(wmemmove (wchar_t * __s1,const wchar_t * __s2,size_t __n))60 __NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n))
61 {
62 return __glibc_fortify_n (wmemmove, __n, sizeof (wchar_t),
63 __glibc_objsize0 (__s1),
64 __s1, __s2, __n);
65 }
66
67
68 #ifdef __USE_GNU
69 extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1,
70 const wchar_t *__restrict __s2, size_t __n,
71 size_t __ns1) __THROW;
72 extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias,
73 (wchar_t *__restrict __s1,
74 const wchar_t *__restrict __s2,
75 size_t __n), wmempcpy);
76 extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn,
77 (wchar_t *__restrict __s1,
78 const wchar_t *__restrict __s2, size_t __n,
79 size_t __ns1), __wmempcpy_chk)
80 __warnattr ("wmempcpy called with length bigger than size of destination "
81 "buffer");
82
83 __fortify_function wchar_t *
__NTH(wmempcpy (wchar_t * __restrict __s1,const wchar_t * __restrict __s2,size_t __n))84 __NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
85 size_t __n))
86 {
87 return __glibc_fortify_n (wmempcpy, __n, sizeof (wchar_t),
88 __glibc_objsize0 (__s1),
89 __s1, __s2, __n);
90 }
91 #endif
92
93
94 extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
95 size_t __ns) __THROW;
96 extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
97 size_t __n), wmemset);
98 extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn,
99 (wchar_t *__s, wchar_t __c, size_t __n,
100 size_t __ns), __wmemset_chk)
101 __warnattr ("wmemset called with length bigger than size of destination "
102 "buffer");
103
104 __fortify_function wchar_t *
__NTH(wmemset (wchar_t * __s,wchar_t __c,size_t __n))105 __NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n))
106 {
107 return __glibc_fortify_n (wmemset, __n, sizeof (wchar_t),
108 __glibc_objsize0 (__s),
109 __s, __c, __n);
110 }
111
112
113 extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest,
114 const wchar_t *__restrict __src,
115 size_t __n) __THROW;
116 extern wchar_t *__REDIRECT_NTH (__wcscpy_alias,
117 (wchar_t *__restrict __dest,
118 const wchar_t *__restrict __src), wcscpy);
119
120 __fortify_function wchar_t *
__NTH(wcscpy (wchar_t * __restrict __dest,const wchar_t * __restrict __src))121 __NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
122 {
123 size_t sz = __glibc_objsize (__dest);
124 if (sz != (size_t) -1)
125 return __wcscpy_chk (__dest, __src, sz / sizeof (wchar_t));
126 return __wcscpy_alias (__dest, __src);
127 }
128
129
130 extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest,
131 const wchar_t *__restrict __src,
132 size_t __destlen) __THROW;
133 extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias,
134 (wchar_t *__restrict __dest,
135 const wchar_t *__restrict __src), wcpcpy);
136
137 __fortify_function wchar_t *
__NTH(wcpcpy (wchar_t * __restrict __dest,const wchar_t * __restrict __src))138 __NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
139 {
140 size_t sz = __glibc_objsize (__dest);
141 if (sz != (size_t) -1)
142 return __wcpcpy_chk (__dest, __src, sz / sizeof (wchar_t));
143 return __wcpcpy_alias (__dest, __src);
144 }
145
146
147 extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest,
148 const wchar_t *__restrict __src, size_t __n,
149 size_t __destlen) __THROW;
150 extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias,
151 (wchar_t *__restrict __dest,
152 const wchar_t *__restrict __src,
153 size_t __n), wcsncpy);
154 extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn,
155 (wchar_t *__restrict __dest,
156 const wchar_t *__restrict __src,
157 size_t __n, size_t __destlen), __wcsncpy_chk)
158 __warnattr ("wcsncpy called with length bigger than size of destination "
159 "buffer");
160
161 __fortify_function wchar_t *
__NTH(wcsncpy (wchar_t * __restrict __dest,const wchar_t * __restrict __src,size_t __n))162 __NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
163 size_t __n))
164 {
165 return __glibc_fortify_n (wcsncpy, __n, sizeof (wchar_t),
166 __glibc_objsize (__dest),
167 __dest, __src, __n);
168 }
169
170
171 extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest,
172 const wchar_t *__restrict __src, size_t __n,
173 size_t __destlen) __THROW;
174 extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias,
175 (wchar_t *__restrict __dest,
176 const wchar_t *__restrict __src,
177 size_t __n), wcpncpy);
178 extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn,
179 (wchar_t *__restrict __dest,
180 const wchar_t *__restrict __src,
181 size_t __n, size_t __destlen), __wcpncpy_chk)
182 __warnattr ("wcpncpy called with length bigger than size of destination "
183 "buffer");
184
185 __fortify_function wchar_t *
__NTH(wcpncpy (wchar_t * __restrict __dest,const wchar_t * __restrict __src,size_t __n))186 __NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
187 size_t __n))
188 {
189 return __glibc_fortify_n (wcpncpy, __n, sizeof (wchar_t),
190 __glibc_objsize (__dest),
191 __dest, __src, __n);
192 }
193
194
195 extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest,
196 const wchar_t *__restrict __src,
197 size_t __destlen) __THROW;
198 extern wchar_t *__REDIRECT_NTH (__wcscat_alias,
199 (wchar_t *__restrict __dest,
200 const wchar_t *__restrict __src), wcscat);
201
202 __fortify_function wchar_t *
__NTH(wcscat (wchar_t * __restrict __dest,const wchar_t * __restrict __src))203 __NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
204 {
205 size_t sz = __glibc_objsize (__dest);
206 if (sz != (size_t) -1)
207 return __wcscat_chk (__dest, __src, sz / sizeof (wchar_t));
208 return __wcscat_alias (__dest, __src);
209 }
210
211
212 extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest,
213 const wchar_t *__restrict __src,
214 size_t __n, size_t __destlen) __THROW;
215 extern wchar_t *__REDIRECT_NTH (__wcsncat_alias,
216 (wchar_t *__restrict __dest,
217 const wchar_t *__restrict __src,
218 size_t __n), wcsncat);
219
220 __fortify_function wchar_t *
__NTH(wcsncat (wchar_t * __restrict __dest,const wchar_t * __restrict __src,size_t __n))221 __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
222 size_t __n))
223 {
224 size_t sz = __glibc_objsize (__dest);
225 if (sz != (size_t) -1)
226 return __wcsncat_chk (__dest, __src, __n, sz / sizeof (wchar_t));
227 return __wcsncat_alias (__dest, __src, __n);
228 }
229
230
231 extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
232 int __flag, size_t __s_len,
233 const wchar_t *__restrict __format, ...)
234 __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
235
236 extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
237 (wchar_t *__restrict __s, size_t __n,
238 const wchar_t *__restrict __fmt, ...),
239 swprintf);
240
241 #ifdef __va_arg_pack
242 __fortify_function int
__NTH(swprintf (wchar_t * __restrict __s,size_t __n,const wchar_t * __restrict __fmt,...))243 __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
244 const wchar_t *__restrict __fmt, ...))
245 {
246 size_t sz = __glibc_objsize (__s);
247 if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
248 return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
249 sz / sizeof (wchar_t), __fmt, __va_arg_pack ());
250 return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
251 }
252 #elif !defined __cplusplus
253 /* XXX We might want to have support in gcc for swprintf. */
254 # define swprintf(s, n, ...) \
255 (__glibc_objsize (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \
256 ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, \
257 __glibc_objsize (s) / sizeof (wchar_t), __VA_ARGS__) \
258 : swprintf (s, n, __VA_ARGS__))
259 #endif
260
261 extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
262 int __flag, size_t __s_len,
263 const wchar_t *__restrict __format,
264 __gnuc_va_list __arg)
265 __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
266
267 extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
268 (wchar_t *__restrict __s, size_t __n,
269 const wchar_t *__restrict __fmt,
270 __gnuc_va_list __ap), vswprintf);
271
272 __fortify_function int
__NTH(vswprintf (wchar_t * __restrict __s,size_t __n,const wchar_t * __restrict __fmt,__gnuc_va_list __ap))273 __NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
274 const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
275 {
276 size_t sz = __glibc_objsize (__s);
277 if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
278 return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
279 sz / sizeof (wchar_t), __fmt, __ap);
280 return __vswprintf_alias (__s, __n, __fmt, __ap);
281 }
282
283
284 #if __USE_FORTIFY_LEVEL > 1
285
286 extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
287 const wchar_t *__restrict __format, ...);
288 extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format,
289 ...);
290 extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
291 const wchar_t *__restrict __format,
292 __gnuc_va_list __ap);
293 extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
294 __gnuc_va_list __ap);
295
296 # ifdef __va_arg_pack
297 __fortify_function int
wprintf(const wchar_t * __restrict __fmt,...)298 wprintf (const wchar_t *__restrict __fmt, ...)
299 {
300 return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
301 }
302
303 __fortify_function int
fwprintf(__FILE * __restrict __stream,const wchar_t * __restrict __fmt,...)304 fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
305 {
306 return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
307 __va_arg_pack ());
308 }
309 # elif !defined __cplusplus
310 # define wprintf(...) \
311 __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
312 # define fwprintf(stream, ...) \
313 __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
314 # endif
315
316 __fortify_function int
vwprintf(const wchar_t * __restrict __fmt,__gnuc_va_list __ap)317 vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
318 {
319 return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
320 }
321
322 __fortify_function int
vfwprintf(__FILE * __restrict __stream,const wchar_t * __restrict __fmt,__gnuc_va_list __ap)323 vfwprintf (__FILE *__restrict __stream,
324 const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
325 {
326 return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
327 }
328
329 #endif
330
331 extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n,
332 __FILE *__restrict __stream) __wur;
333 extern wchar_t *__REDIRECT (__fgetws_alias,
334 (wchar_t *__restrict __s, int __n,
335 __FILE *__restrict __stream), fgetws) __wur;
336 extern wchar_t *__REDIRECT (__fgetws_chk_warn,
337 (wchar_t *__restrict __s, size_t __size, int __n,
338 __FILE *__restrict __stream), __fgetws_chk)
339 __wur __warnattr ("fgetws called with bigger size than length "
340 "of destination buffer");
341
342 __fortify_function __wur wchar_t *
fgetws(wchar_t * __restrict __s,int __n,__FILE * __restrict __stream)343 fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
344 {
345 size_t sz = __glibc_objsize (__s);
346 if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), sz))
347 return __fgetws_alias (__s, __n, __stream);
348 if (__glibc_unsafe_len (__n, sizeof (wchar_t), sz))
349 return __fgetws_chk_warn (__s, sz / sizeof (wchar_t), __n, __stream);
350 return __fgetws_chk (__s, sz / sizeof (wchar_t), __n, __stream);
351 }
352
353 #ifdef __USE_GNU
354 extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
355 int __n, __FILE *__restrict __stream)
356 __wur;
357 extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
358 (wchar_t *__restrict __s, int __n,
359 __FILE *__restrict __stream), fgetws_unlocked)
360 __wur;
361 extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn,
362 (wchar_t *__restrict __s, size_t __size, int __n,
363 __FILE *__restrict __stream),
364 __fgetws_unlocked_chk)
365 __wur __warnattr ("fgetws_unlocked called with bigger size than length "
366 "of destination buffer");
367
368 __fortify_function __wur wchar_t *
fgetws_unlocked(wchar_t * __restrict __s,int __n,__FILE * __restrict __stream)369 fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
370 {
371 size_t sz = __glibc_objsize (__s);
372 if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), sz))
373 return __fgetws_unlocked_alias (__s, __n, __stream);
374 if (__glibc_unsafe_len (__n, sizeof (wchar_t), sz))
375 return __fgetws_unlocked_chk_warn (__s, sz / sizeof (wchar_t), __n,
376 __stream);
377 return __fgetws_unlocked_chk (__s, sz / sizeof (wchar_t), __n, __stream);
378 }
379 #endif
380
381
382 extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar,
383 mbstate_t *__restrict __p,
384 size_t __buflen) __THROW __wur;
385 extern size_t __REDIRECT_NTH (__wcrtomb_alias,
386 (char *__restrict __s, wchar_t __wchar,
387 mbstate_t *__restrict __ps), wcrtomb) __wur;
388
389 __fortify_function __wur size_t
__NTH(wcrtomb (char * __restrict __s,wchar_t __wchar,mbstate_t * __restrict __ps))390 __NTH (wcrtomb (char *__restrict __s, wchar_t __wchar,
391 mbstate_t *__restrict __ps))
392 {
393 /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
394 But this would only disturb the namespace. So we define our own
395 version here. */
396 #define __WCHAR_MB_LEN_MAX 16
397 #if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX
398 # error "Assumed value of MB_LEN_MAX wrong"
399 #endif
400 if (__glibc_objsize (__s) != (size_t) -1
401 && __WCHAR_MB_LEN_MAX > __glibc_objsize (__s))
402 return __wcrtomb_chk (__s, __wchar, __ps, __glibc_objsize (__s));
403 return __wcrtomb_alias (__s, __wchar, __ps);
404 }
405
406
407 extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst,
408 const char **__restrict __src,
409 size_t __len, mbstate_t *__restrict __ps,
410 size_t __dstlen) __THROW;
411 extern size_t __REDIRECT_NTH (__mbsrtowcs_alias,
412 (wchar_t *__restrict __dst,
413 const char **__restrict __src,
414 size_t __len, mbstate_t *__restrict __ps),
415 mbsrtowcs);
416 extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn,
417 (wchar_t *__restrict __dst,
418 const char **__restrict __src,
419 size_t __len, mbstate_t *__restrict __ps,
420 size_t __dstlen), __mbsrtowcs_chk)
421 __warnattr ("mbsrtowcs called with dst buffer smaller than len "
422 "* sizeof (wchar_t)");
423
424 __fortify_function size_t
__NTH(mbsrtowcs (wchar_t * __restrict __dst,const char ** __restrict __src,size_t __len,mbstate_t * __restrict __ps))425 __NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
426 size_t __len, mbstate_t *__restrict __ps))
427 {
428 return __glibc_fortify_n (mbsrtowcs, __len, sizeof (wchar_t),
429 __glibc_objsize (__dst),
430 __dst, __src, __len, __ps);
431 }
432
433
434 extern size_t __wcsrtombs_chk (char *__restrict __dst,
435 const wchar_t **__restrict __src,
436 size_t __len, mbstate_t *__restrict __ps,
437 size_t __dstlen) __THROW;
438 extern size_t __REDIRECT_NTH (__wcsrtombs_alias,
439 (char *__restrict __dst,
440 const wchar_t **__restrict __src,
441 size_t __len, mbstate_t *__restrict __ps),
442 wcsrtombs);
443 extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn,
444 (char *__restrict __dst,
445 const wchar_t **__restrict __src,
446 size_t __len, mbstate_t *__restrict __ps,
447 size_t __dstlen), __wcsrtombs_chk)
448 __warnattr ("wcsrtombs called with dst buffer smaller than len");
449
450 __fortify_function size_t
__NTH(wcsrtombs (char * __restrict __dst,const wchar_t ** __restrict __src,size_t __len,mbstate_t * __restrict __ps))451 __NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
452 size_t __len, mbstate_t *__restrict __ps))
453 {
454 return __glibc_fortify (wcsrtombs, __len, sizeof (char),
455 __glibc_objsize (__dst),
456 __dst, __src, __len, __ps);
457 }
458
459
460 #ifdef __USE_XOPEN2K8
461 extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst,
462 const char **__restrict __src, size_t __nmc,
463 size_t __len, mbstate_t *__restrict __ps,
464 size_t __dstlen) __THROW;
465 extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias,
466 (wchar_t *__restrict __dst,
467 const char **__restrict __src, size_t __nmc,
468 size_t __len, mbstate_t *__restrict __ps),
469 mbsnrtowcs);
470 extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn,
471 (wchar_t *__restrict __dst,
472 const char **__restrict __src, size_t __nmc,
473 size_t __len, mbstate_t *__restrict __ps,
474 size_t __dstlen), __mbsnrtowcs_chk)
475 __warnattr ("mbsnrtowcs called with dst buffer smaller than len "
476 "* sizeof (wchar_t)");
477
478 __fortify_function size_t
__NTH(mbsnrtowcs (wchar_t * __restrict __dst,const char ** __restrict __src,size_t __nmc,size_t __len,mbstate_t * __restrict __ps))479 __NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
480 size_t __nmc, size_t __len, mbstate_t *__restrict __ps))
481 {
482 return __glibc_fortify_n (mbsnrtowcs, __len, sizeof (wchar_t),
483 __glibc_objsize (__dst),
484 __dst, __src, __nmc, __len, __ps);
485 }
486
487
488 extern size_t __wcsnrtombs_chk (char *__restrict __dst,
489 const wchar_t **__restrict __src,
490 size_t __nwc, size_t __len,
491 mbstate_t *__restrict __ps, size_t __dstlen)
492 __THROW;
493 extern size_t __REDIRECT_NTH (__wcsnrtombs_alias,
494 (char *__restrict __dst,
495 const wchar_t **__restrict __src,
496 size_t __nwc, size_t __len,
497 mbstate_t *__restrict __ps), wcsnrtombs);
498 extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn,
499 (char *__restrict __dst,
500 const wchar_t **__restrict __src,
501 size_t __nwc, size_t __len,
502 mbstate_t *__restrict __ps,
503 size_t __dstlen), __wcsnrtombs_chk)
504 __warnattr ("wcsnrtombs called with dst buffer smaller than len");
505
506 __fortify_function size_t
__NTH(wcsnrtombs (char * __restrict __dst,const wchar_t ** __restrict __src,size_t __nwc,size_t __len,mbstate_t * __restrict __ps))507 __NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
508 size_t __nwc, size_t __len, mbstate_t *__restrict __ps))
509 {
510 return __glibc_fortify (wcsnrtombs, __len, sizeof (char),
511 __glibc_objsize (__dst),
512 __dst, __src, __nwc, __len, __ps);
513 }
514 #endif
515