summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2014-07-03 15:58:06 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2014-07-03 15:58:06 (GMT)
commitad4690fcca5704277abece184d49b39a913029d4 (patch)
tree20fc0b168375bc7b17bc7b34f1b053cac40b908a /PC
parent0d50af45b654784fe639ab6489f91e7524ed3ace (diff)
downloadcpython-ad4690fcca5704277abece184d49b39a913029d4.zip
cpython-ad4690fcca5704277abece184d49b39a913029d4.tar.gz
cpython-ad4690fcca5704277abece184d49b39a913029d4.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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/PC/winreg.c b/PC/winreg.c
index d23810b..63c437e 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -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;