diff Python/pystate.c @ 78678:7789111afe05

Issue #15726: Fix incorrect bounds checking in PyState_FindModule. Patch by Robin Schreiber.
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 20 Aug 2012 19:31:52 +0200
parents 55e8cba34b11 b96a4b1e7ecb
children 5aa1bc2f00ad 6bcaba9e8df2
line wrap: on
line diff
--- a/Python/pystate.c	Mon Aug 20 17:20:46 2012 +0200
+++ b/Python/pystate.c	Mon Aug 20 19:31:52 2012 +0200
@@ -248,7 +248,7 @@
         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;