Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc60cdd

Browse files
authored
bpo-8677: use PY_DWORD_MAX instead of INT_MAX (GH-12469)
1 parent d5f18a6 commit cc60cdd

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

PC/winreg.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,13 +1605,11 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
16051605
long rc;
16061606

16071607
if (type != REG_SZ) {
1608-
PyErr_SetString(PyExc_TypeError,
1609-
"Type must be winreg.REG_SZ");
1608+
PyErr_SetString(PyExc_TypeError, "type must be winreg.REG_SZ");
16101609
return NULL;
16111610
}
1612-
if (value_length >= INT_MAX) {
1613-
PyErr_SetString(PyExc_OverflowError,
1614-
"the value is too long");
1611+
if ((size_t)value_length >= PY_DWORD_MAX) {
1612+
PyErr_SetString(PyExc_OverflowError, "value is too long");
16151613
return NULL;
16161614
}
16171615

0 commit comments

Comments
 (0)