From 10f40cd64c5c853c6da463f7dd1df6427f5d8535 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 20 Aug 2012 19:30:46 +0200 Subject: Issue #15726: Fix incorrect bounds checking in PyState_FindModule. Patch by Robin Schreiber. --- Python/pystate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/pystate.c') diff --git a/Python/pystate.c b/Python/pystate.c index 31b5423d38..13923313c0 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; -- cgit v1.2.1