diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2013-10-03 19:53:45 +0200 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2013-10-03 19:54:23 +0200 |
commit | b1fe1f2b834635372df6c68312fd6b3a8e559595 (patch) | |
tree | 027f56ac50904f446d2f57785a3c9a7bf2c07515 /manual | |
parent | 5f855e3598a576c35e54623a13b256f3e87fcd4d (diff) | |
download | glibc-b1fe1f2b834635372df6c68312fd6b3a8e559595.tar glibc-b1fe1f2b834635372df6c68312fd6b3a8e559595.tar.gz glibc-b1fe1f2b834635372df6c68312fd6b3a8e559595.tar.bz2 glibc-b1fe1f2b834635372df6c68312fd6b3a8e559595.zip |
BZ #431 Fix manual of strncat/wcsncat.
Diffstat (limited to 'manual')
-rw-r--r-- | manual/string.texi | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/manual/string.texi b/manual/string.texi index 3329761fc9..1e45d9ddbc 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -955,8 +955,8 @@ The @code{strncat} function could be implemented like this: char * strncat (char *to, const char *from, size_t size) @{ - to[strlen (to) + size] = '\0'; - strncpy (to + strlen (to), from, size); + memcpy (to + strlen (to), from, strnlen (from, size)); + to[strlen (to) + strnlen (from, size)] = '\0'; return to; @} @end group @@ -982,8 +982,8 @@ wchar_t * wcsncat (wchar_t *restrict wto, const wchar_t *restrict wfrom, size_t size) @{ - wto[wcslen (to) + size] = L'\0'; - wcsncpy (wto + wcslen (wto), wfrom, size); + memcpy (wto + wcslen (wto), wfrom, wcsnlen (wfrom, size) * sizeof (wchar_t)); + wto[wcslen (to) + wcsnlen (wfrom, size)] = '\0'; return wto; @} @end group |