Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adélie Linux
gcompat
Commits
c820eed5
Verified
Commit
c820eed5
authored
May 07, 2019
by
A. Wilcox
🦊
Browse files
wchar: Add __wcscpy_chk
parent
620e2ff5
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.rst
View file @
c820eed5
...
...
@@ -11,6 +11,11 @@
1.0.0 (20??-??-??)
==================
wchar
-----
* Add __wcscpy_chk.
0.4.0 (2019-05-03)
==================
...
...
libgcompat/wchar.c
View file @
c820eed5
...
...
@@ -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).
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment