mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-11 20:00:07 +00:00
cheri: Fix invalid pointer deref in wcpcpy_chk
Accessing src via the dest pointer is invalid.
This commit is contained in:
parent
dec33ea23f
commit
1943345fa3
@ -28,13 +28,12 @@ __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 (__glibc_unlikely (destlen-- == 0))
|
||||
__chk_fail ();
|
||||
c = wcp[off];
|
||||
c = *src++;
|
||||
*++wcp = c;
|
||||
}
|
||||
while (c != L'\0');
|
||||
|
Loading…
Reference in New Issue
Block a user