@@ -12,6 +12,7 @@ |
|
|
12 |
12 |
|
13 |
13 |
*/ |
14 |
14 |
|
|
15 |
+#define PY_SSIZE_T_CLEAN |
15 |
16 |
#include "Python.h" |
16 |
17 |
#include "structmember.h" |
17 |
18 |
#include "windows.h" |
@@ -1608,6 +1609,11 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, |
|
|
1608 |
1609 |
"Type must be winreg.REG_SZ"); |
1609 |
1610 |
return NULL; |
1610 |
1611 |
} |
|
1612 |
+if (value_length >= INT_MAX) { |
|
1613 |
+PyErr_SetString(PyExc_OverflowError, |
|
1614 |
+"the value is too long"); |
|
1615 |
+return NULL; |
|
1616 |
+ } |
1611 |
1617 |
|
1612 |
1618 |
Py_BEGIN_ALLOW_THREADS |
1613 |
1619 |
rc = RegSetValueW(key, sub_key, REG_SZ, value, value_length+1); |