Last active
December 16, 2015 23:29
-
-
Save kosaki/5514541 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__fortify_function wchar_t * | |
__NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) | |
{ | |
if (__bos (__dest) != (size_t) -1) | |
return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); | |
return __wcpcpy_alias (__dest, __src); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copy SRC to DEST, returning the address of the terminating L'\0' in | |
DEST. Check for overflows. */ | |
wchar_t * | |
__wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen) | |
{ | |
wchar_t *wcp = (wchar_t *) dest - 1; | |
wint_t c; | |
const ptrdiff_t off = src - dest + 1; | |
do | |
{ | |
if (__builtin_expect (destlen-- == 0, 0)) | |
__chk_fail (); | |
c = wcp[off]; | |
*++wcp = c; | |
} | |
while (c != L'\0'); | |
return wcp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment