Unverified Kaydet (Commit) d5f18a63 authored tarafından Inada Naoki's avatar Inada Naoki Kaydeden (comit) GitHub

bpo-8677: use PY_SSIZE_T_CLEAN in PC/winreg.c (GH-12466)

üst e9a1dcb4
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#define PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
#include "structmember.h" #include "structmember.h"
#include "windows.h" #include "windows.h"
...@@ -1608,6 +1609,11 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, ...@@ -1608,6 +1609,11 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
"Type must be winreg.REG_SZ"); "Type must be winreg.REG_SZ");
return NULL; return NULL;
} }
if (value_length >= INT_MAX) {
PyErr_SetString(PyExc_OverflowError,
"the value is too long");
return NULL;
}
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
rc = RegSetValueW(key, sub_key, REG_SZ, value, value_length+1); rc = RegSetValueW(key, sub_key, REG_SZ, value, value_length+1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment