summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-08-20 17:30:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-08-20 17:30:46 (GMT)
commit75506e8b7cc1b21fd10997e4e5d382c515558fa8 (patch)
tree3847d540e00e46db8a9262754ecc3dcd2e906c2d /Python/pystate.c
parent07795df68345a481fbd72c8cce452666000cbadd (diff)
downloadcpython-75506e8b7cc1b21fd10997e4e5d382c515558fa8.zip
cpython-75506e8b7cc1b21fd10997e4e5d382c515558fa8.tar.gz
cpython-75506e8b7cc1b21fd10997e4e5d382c515558fa8.tar.bz2
Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 31b5423..1392331 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -248,7 +248,7 @@ PyState_FindModule(struct PyModuleDef* m)
return NULL;
if (state->modules_by_index == NULL)
return NULL;
- if (index > PyList_GET_SIZE(state->modules_by_index))
+ if (index >= PyList_GET_SIZE(state->modules_by_index))
return NULL;
res = PyList_GET_ITEM(state->modules_by_index, index);
return res==Py_None ? NULL : res;