diff options
author | Inada Naoki <songofacandy@gmail.com> | 2019-03-20 10:10:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 10:10:17 (GMT) |
commit | d5f18a63cc2dfe8d0adec8bce384a8c569b0f3dc (patch) | |
tree | a8077a2e58dee622a9d868b3a37acc4ef744005b /PC | |
parent | e9a1dcb4237cb2be71ab05883d472038ea9caf62 (diff) | |
download | cpython-d5f18a63cc2dfe8d0adec8bce384a8c569b0f3dc.zip cpython-d5f18a63cc2dfe8d0adec8bce384a8c569b0f3dc.tar.gz cpython-d5f18a63cc2dfe8d0adec8bce384a8c569b0f3dc.tar.bz2 |
bpo-8677: use PY_SSIZE_T_CLEAN in PC/winreg.c (GH-12466)
Diffstat (limited to 'PC')
-rw-r--r-- | PC/winreg.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/PC/winreg.c b/PC/winreg.c index 3a6ea36..4dc4e0c 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -12,6 +12,7 @@ */ +#define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" #include "windows.h" @@ -1608,6 +1609,11 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, "Type must be winreg.REG_SZ"); return NULL; } + if (value_length >= INT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "the value is too long"); + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegSetValueW(key, sub_key, REG_SZ, value, value_length+1); |