Address 64bit MinGW compile warning (fixes #15)
../../../xmlparse.c: In function ‘generate_hash_secret_salt’: ../../../xmlparse.c:725:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] gather_time_entropy() ^ getpid() ^ (unsigned long)parser; ^ Thanks to Viktor Szakats.
This commit is contained in:
parent
ff9cf997fb
commit
863c43087f
@ -23,6 +23,7 @@ Release ??????????
|
|||||||
Rhodri James
|
Rhodri James
|
||||||
Sergei Nikulov
|
Sergei Nikulov
|
||||||
Tobias Taschner
|
Tobias Taschner
|
||||||
|
Viktor Szakats
|
||||||
|
|
||||||
Release 2.2.0 Tue June 21 2016
|
Release 2.2.0 Tue June 21 2016
|
||||||
Security fixes:
|
Security fixes:
|
||||||
|
@ -719,6 +719,14 @@ gather_time_entropy(void)
|
|||||||
static unsigned long
|
static unsigned long
|
||||||
generate_hash_secret_salt(XML_Parser parser)
|
generate_hash_secret_salt(XML_Parser parser)
|
||||||
{
|
{
|
||||||
|
#if defined(__UINTPTR_TYPE__)
|
||||||
|
# define PARSER_CAST(p) (__UINTPTR_TYPE__)(p)
|
||||||
|
#elif defined(_WIN64) && defined(_MSC_VER)
|
||||||
|
# define PARSER_CAST(p) (unsigned __int64)(p)
|
||||||
|
#else
|
||||||
|
# define PARSER_CAST(p) (p)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __CloudABI__
|
#ifdef __CloudABI__
|
||||||
unsigned long entropy;
|
unsigned long entropy;
|
||||||
(void)parser;
|
(void)parser;
|
||||||
@ -729,7 +737,7 @@ generate_hash_secret_salt(XML_Parser parser)
|
|||||||
/* Process ID is 0 bits entropy if attacker has local access
|
/* Process ID is 0 bits entropy if attacker has local access
|
||||||
* XML_Parser address is few bits of entropy if attacker has local access */
|
* XML_Parser address is few bits of entropy if attacker has local access */
|
||||||
const unsigned long entropy =
|
const unsigned long entropy =
|
||||||
gather_time_entropy() ^ getpid() ^ (unsigned long)parser;
|
gather_time_entropy() ^ getpid() ^ (unsigned long)PARSER_CAST(parser);
|
||||||
|
|
||||||
/* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */
|
/* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */
|
||||||
if (sizeof(unsigned long) == 4) {
|
if (sizeof(unsigned long) == 4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user