diff options
Diffstat (limited to 'Python/bootstrap_hash.c')
-rw-r--r-- | Python/bootstrap_hash.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index 793c646f12..eb848c8ff6 100644 --- a/Python/bootstrap_hash.c +++ b/Python/bootstrap_hash.c @@ -55,8 +55,6 @@ error: static int win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) { - Py_ssize_t chunk; - if (hCryptProv == 0) { if (win32_urandom_init(raise) == -1) { @@ -66,8 +64,8 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) while (size > 0) { - chunk = size > INT_MAX ? INT_MAX : size; - if (!CryptGenRandom(hCryptProv, (DWORD)chunk, buffer)) + DWORD chunk = (DWORD)Py_MIN(size, PY_DWORD_MAX); + if (!CryptGenRandom(hCryptProv, chunk, buffer)) { /* CryptGenRandom() failed */ if (raise) { |