mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 08:30:21 +00:00
[VCRUNTIME] Fix a bug in x64 __security_init_cookie
This commit is contained in:
parent
182f353b2f
commit
52719b52ae
1 changed files with 6 additions and 5 deletions
|
@ -70,16 +70,17 @@ void __security_init_cookie(void)
|
||||||
randomValue += GetCurrentProcessId();
|
randomValue += GetCurrentProcessId();
|
||||||
randomValue = _rotlptr(randomValue, GetCurrentProcessId() >> 2);
|
randomValue = _rotlptr(randomValue, GetCurrentProcessId() >> 2);
|
||||||
|
|
||||||
if (randomValue == DEFAULT_SECURITY_COOKIE)
|
|
||||||
{
|
|
||||||
randomValue++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
/* Zero out highest 16 bits */
|
/* Zero out highest 16 bits */
|
||||||
randomValue &= 0x0000FFFFFFFFFFFFull;
|
randomValue &= 0x0000FFFFFFFFFFFFull;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Avoid the default security cookie */
|
||||||
|
if (randomValue == DEFAULT_SECURITY_COOKIE)
|
||||||
|
{
|
||||||
|
randomValue++;
|
||||||
|
}
|
||||||
|
|
||||||
__security_cookie = randomValue;
|
__security_cookie = randomValue;
|
||||||
__security_cookie_complement = ~randomValue;
|
__security_cookie_complement = ~randomValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue