Description: Fix upstream bug with array index
 A wrong index coding selects the wrong array element and potentially causes also
 unbound memory access
Author: Massimo Manghi <mxmanghi@apache.org>
Bug: https://core.tcl.tk/tdbcmysql/tktview?name=f3c6ec0369
Last-Update: 2016-08-17
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/generic/mysqlStubInit.c
+++ b/generic/mysqlStubInit.c
@@ -142,7 +142,7 @@
     for (i = 0; status == TCL_ERROR && mysqlStubLibNames[i] != NULL; ++i) {
 	for (j = 0; status == TCL_ERROR && (j < sizeof(mysqlSuffixes)/sizeof(mysqlSuffixes[0])); ++j) {
 	    path = Tcl_NewStringObj(LIBPREFIX, -1);
-	    Tcl_AppendToObj(path, mysqlStubLibNames[j], -1);
+	    Tcl_AppendToObj(path, mysqlStubLibNames[i], -1);
 #ifdef __CYGWIN__
 	    if (*mysqlSuffixes[j]) {
 		Tcl_AppendToObj(path, "-", -1);
