[issue21151] winreg.SetValueEx causes crash if value = None

eryksun report at bugs.python.org
Fri Apr 4 07:28:56 CEST 2014


eryksun added the comment:

In Py2Reg, the REG_BINARY (3) case sets `*retDataSize = 0` when the value is None: 

http://hg.python.org/cpython/file/04f714765c13/PC/winreg.c#l766

It doesn't modify *retDataBuf. Then in PySetValueEx, PyMem_DEL is called for the uninitialized address in data:

http://hg.python.org/cpython/file/04f714765c13/PC/winreg.c#l1566

Py2Reg in this case could also set `*retDataBuf = NULL`. RegSetValueEx allows lpData to be NULL when cbData is 0. 

http://msdn.microsoft.com/en-us/library/ms724923

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21151>
_______________________________________


More information about the Python-bugs-list mailing list