Verified Commit c820eed5 authored by A. Wilcox's avatar A. Wilcox

wchar: Add __wcscpy_chk

parent 620e2ff5
......@@ -11,6 +11,11 @@
1.0.0 (20??-??-??)
==================
wchar
-----
* Add __wcscpy_chk.
0.4.0 (2019-05-03)
==================
......
......@@ -39,6 +39,27 @@ int __vswprintf_chk(wchar_t *s, size_t n, int flag, size_t slen,
return vswprintf(s, n, format, ap);
}
/**
* Copy a wide-character string, with buffer overflow checking
*
* LSB 5.0: LSB-Core-generic/baselib---wcscpy-chk-1.html
*/
wchar_t *__wcscpy_chk(wchar_t *dest, const wchar_t *src, size_t n)
{
size_t srclen = wcslen(src) + 1;
assert(dest != NULL);
assert(src != NULL);
assert(n >= srclen);
if (dest < src) {
assert(dest + n <= src);
} else {
assert(src + n <= dest);
}
return wcscpy(dest, src);
}
/**
* Representation of the glibc internals of wcstol(3).
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment