diff options
Diffstat (limited to 'include/string.h')
| -rw-r--r-- | include/string.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h index e681181..ab7ac43 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -35,6 +35,7 @@ extern "C" { | |||
| 35 | #undef memset | 35 | #undef memset |
| 36 | #undef strcat | 36 | #undef strcat |
| 37 | #undef strcpy | 37 | #undef strcpy |
| 38 | #undef strlen | ||
| 38 | #undef strncat | 39 | #undef strncat |
| 39 | #undef strncpy | 40 | #undef strncpy |
| 40 | 41 | ||
| @@ -237,6 +238,22 @@ _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) | |||
| 237 | #endif | 238 | #endif |
| 238 | } | 239 | } |
| 239 | 240 | ||
| 241 | __access (read_only, 1) | ||
| 242 | #if __has_builtin(__builtin_strlen) | ||
| 243 | __diagnose_as_builtin(__builtin_strlen, 1) | ||
| 244 | #endif | ||
| 245 | _FORTIFY_FN(strlen) size_t strlen(const char * _FORTIFY_POS0 __s) | ||
| 246 | { | ||
| 247 | #if __has_builtin(__builtin___strlen_chk) && USE_NATIVE_CHK | ||
| 248 | return __builtin___strlen_chk(__s, __bos(__s, 0)); | ||
| 249 | #else | ||
| 250 | size_t ret = __orig_strlen(__s); | ||
| 251 | if (ret > __bos(__s, 0) - 1) | ||
| 252 | __builtin_trap(); | ||
| 253 | return ret; | ||
| 254 | #endif | ||
| 255 | } | ||
| 256 | |||
| 240 | __access (read_write, 1) | 257 | __access (read_write, 1) |
| 241 | __access (read_only, 2, 3) | 258 | __access (read_only, 2, 3) |
| 242 | #if __has_builtin(__builtin_strncat) | 259 | #if __has_builtin(__builtin_strncat) |
