1 | /*␊ |
2 | * Copyright (c) 2007 Apple Inc. All rights reserved.␊ |
3 | *␊ |
4 | *␊ |
5 | * This file contains Original Code and/or Modifications of Original Code␊ |
6 | * as defined in and that are subject to the Apple Public Source License␊ |
7 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
8 | * compliance with the License. Please obtain a copy of the License at␊ |
9 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
10 | * file.␊ |
11 | *␊ |
12 | * The Original Code and all software distributed under the License are␊ |
13 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
17 | * Please see the License for the specific language governing rights and␊ |
18 | * limitations under the License.␊ |
19 | *␊ |
20 | */␊ |
21 | ␊ |
22 | #ifndef _STDIO_H_␊ |
23 | #error error "Never use <secure/_stdio.h> directly; include <stdio.h> instead."␊ |
24 | #endif␊ |
25 | ␊ |
26 | #ifndef _SECURE__STDIO_H_␊ |
27 | #define _SECURE__STDIO_H_␊ |
28 | ␊ |
29 | #include <secure/_common.h>␊ |
30 | ␊ |
31 | #if _USE_FORTIFY_LEVEL > 0␊ |
32 | ␊ |
33 | #undef sprintf␊ |
34 | #undef vsprintf␊ |
35 | #undef snprintf␊ |
36 | #undef vsnprintf␊ |
37 | ␊ |
38 | /* sprintf, vsprintf, snprintf, vsnprintf */␊ |
39 | ␊ |
40 | extern int __sprintf_chk (char * __restrict, int, size_t,␊ |
41 | ␉␉␉ const char * __restrict, ...)␊ |
42 | __DARWIN_LDBL_COMPAT (__sprintf_chk);␊ |
43 | ␊ |
44 | #define sprintf(str, ...) \␊ |
45 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)␊ |
46 | ␊ |
47 | extern int __snprintf_chk (char * __restrict, size_t, int, size_t,␊ |
48 | ␉␉␉ const char * __restrict, ...)␊ |
49 | __DARWIN_LDBL_COMPAT (__snprintf_chk);␊ |
50 | ␊ |
51 | #define snprintf(str, len, ...) \␊ |
52 | __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)␊ |
53 | ␊ |
54 | extern int __vsprintf_chk (char * __restrict, int, size_t,␊ |
55 | ␉␉␉ const char * __restrict, va_list)␊ |
56 | __DARWIN_LDBL_COMPAT (__vsprintf_chk);␊ |
57 | ␊ |
58 | #define vsprintf(str, format, ap) \␊ |
59 | __builtin___vsprintf_chk (str, 0, __darwin_obsz(str), format, ap)␊ |
60 | ␊ |
61 | extern int __vsnprintf_chk (char * __restrict, size_t, int, size_t,␊ |
62 | ␉␉␉ const char * __restrict, va_list)␊ |
63 | __DARWIN_LDBL_COMPAT (__vsnprintf_chk);␊ |
64 | ␊ |
65 | #define vsnprintf(str, len, format, ap) \␊ |
66 | __builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)␊ |
67 | ␊ |
68 | ␊ |
69 | #endif␊ |
70 | ␊ |
71 | #endif␊ |
72 | |