mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #21151: Fixed a segfault in the winreg module.
When ``None`` was passed as a ``REG_BINARY`` value to SetValueEx, PyMem_DEL was called on an uninitialized buffer. Patch by John Ehresman. (Also an incidental typo fix in a comment in test_winreg)
This commit is contained in:
parent
0d50af45b6
commit
ad4690fcca
3 changed files with 20 additions and 2 deletions
|
@ -871,8 +871,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
|
|||
/* ALSO handle ALL unknown data types here. Even if we can't
|
||||
support it natively, we should handle the bits. */
|
||||
default:
|
||||
if (value == Py_None)
|
||||
if (value == Py_None) {
|
||||
*retDataSize = 0;
|
||||
*retDataBuf = NULL;
|
||||
}
|
||||
else {
|
||||
Py_buffer view;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue