diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2014-07-03 15:57:44 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2014-07-03 15:57:44 (GMT) |
commit | 6690eed48b3ad97d4383ce612ff4e4c318a80c45 (patch) | |
tree | 797f984f6850165d4645bdb2c402944150ab0d6e /PC | |
parent | 809b665b57edccde6418fb9e4a0135a1e629e79a (diff) | |
download | cpython-6690eed48b3ad97d4383ce612ff4e4c318a80c45.zip cpython-6690eed48b3ad97d4383ce612ff4e4c318a80c45.tar.gz cpython-6690eed48b3ad97d4383ce612ff4e4c318a80c45.tar.bz2 |
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)
Diffstat (limited to 'PC')
-rw-r--r-- | PC/_winreg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/PC/_winreg.c b/PC/_winreg.c index f90a282..f757aa5 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -883,8 +883,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 { void *src_buf; PyBufferProcs *pb = value->ob_type->tp_as_buffer; |