This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tiny bug in win32_urandom
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, rocco_m
Priority: normal Keywords:

Created on 2006-09-03 12:03 by rocco_m, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg29745 - (view) Author: Rocco Matano (rocco_m) Date: 2006-09-03 12:03
In the file ...\Python-2.4.3\Modules\posixmodule.c the
function win32_urandom
tries to get the addresses of the functions
'CryptAcquireContextA' and
'CryptGenRandom' like this:

pCryptAcquireContext=(CRYPTACQUIRECONTEXTA)GetProcAddress(
    hAdvAPI32, "CryptAcquireContextA");
if (pCryptAcquireContext == NULL)
    return PyErr_Format(PyExc_NotImplementedError,
        "CryptAcquireContextA not found");

pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress(
    hAdvAPI32, "CryptGenRandom");
if (pCryptAcquireContext == NULL) /* <- test
pCryptGenRandom instead */
    return PyErr_Format(PyExc_NotImplementedError,
        "CryptGenRandom not found");
        
After the second call to GetProcAddress()
pCryptGenRandom should be tested
against NULL.
msg29746 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-09-06 06:04
Logged In: YES 
user_id=849994

Thanks! Fixed in rev. 51762, 51763 (2.4), 51764 (2.5).
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43934
2006-09-03 12:03:23rocco_mcreate