Index: mysql-connector-odbc-5.1.8/driver/catalog.c
===================================================================
--- mysql-connector-odbc-5.1.8.orig/driver/catalog.c
+++ mysql-connector-odbc-5.1.8/driver/catalog.c
@@ -42,7 +42,7 @@ my_bool server_has_i_s(DBC FAR *dbc)
     According to the server ChangeLog INFORMATION_SCHEMA was introduced
     in the 5.0.2
   */
-  return is_minimum_version(dbc->mysql.server_version, "5.0.2", 5);
+  return is_minimum_version(dbc->mysql.server_version, "5.0.2");
 }
 /*
   @type    : internal
@@ -861,7 +861,7 @@ SQLRETURN i_s_foreign_keys(SQLHSTMT hstm
   /*
      With 5.1, we can use REFERENTIAL_CONSTRAINTS to get even more info.
   */
-  if (is_minimum_version(stmt->dbc->mysql.server_version, "5.1", 3))
+  if (is_minimum_version(stmt->dbc->mysql.server_version, "5.1"))
   {
     update_rule= "CASE"
                  " WHEN R.UPDATE_RULE = 'CASCADE' THEN 0"
Index: mysql-connector-odbc-5.1.8/driver/connect.c
===================================================================
--- mysql-connector-odbc-5.1.8.orig/driver/connect.c
+++ mysql-connector-odbc-5.1.8/driver/connect.c
@@ -243,7 +243,7 @@ SQLRETURN myodbc_do_connect(DBC *dbc, Da
     return SQL_ERROR;
   }
 
-  if (!is_minimum_version(dbc->mysql.server_version, "4.1.1", 5))
+  if (!is_minimum_version(dbc->mysql.server_version, "4.1.1"))
   {
     mysql_close(mysql);
     set_dbc_error(dbc, "08001", "Driver does not support server versions under 4.1.1", 0);
Index: mysql-connector-odbc-5.1.8/driver/execute.c
===================================================================
--- mysql-connector-odbc-5.1.8.orig/driver/execute.c
+++ mysql-connector-odbc-5.1.8/driver/execute.c
@@ -378,7 +378,7 @@ SQLRETURN insert_param(STMT *stmt, char
 
             /* TODO need to check if it was merged to other versions already */
             if (has_utf8_maxlen4 &&
-                !is_minimum_version(dbc->mysql.server_version, "6.0.4", 5))
+                !is_minimum_version(dbc->mysql.server_version, "6.0.4"))
               return set_stmt_error(stmt, "HY000",
                                     "Server does not support 4-byte encoded "
                                     "UTF8 characters.", 0);
Index: mysql-connector-odbc-5.1.8/driver/info.c
===================================================================
--- mysql-connector-odbc-5.1.8.orig/driver/info.c
+++ mysql-connector-odbc-5.1.8/driver/info.c
@@ -190,7 +190,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
 
   case SQL_CREATE_VIEW:
     /** @todo SQL_CV_LOCAL ? */
-    if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_ULONG(SQL_CV_CREATE_VIEW | SQL_CV_CHECK_OPTION |
                        SQL_CV_CASCADED);
     else
@@ -268,7 +268,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
     MYINFO_SET_ULONG(SQL_DT_DROP_TABLE | SQL_DT_CASCADE | SQL_DT_RESTRICT);
 
   case SQL_DROP_VIEW:
-    if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_ULONG(SQL_DV_DROP_VIEW | SQL_DV_CASCADE | SQL_DV_RESTRICT);
     else
       MYINFO_SET_ULONG(0);
@@ -338,7 +338,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
       We have INFORMATION_SCHEMA.SCHEMATA, but we don't report it
       because the driver exposes databases (schema) as catalogs.
     */
-    if (is_minimum_version(dbc->mysql.server_version, "5.1", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.1"))
       MYINFO_SET_ULONG(SQL_ISV_CHARACTER_SETS | SQL_ISV_COLLATIONS |
                        SQL_ISV_COLUMN_PRIVILEGES | SQL_ISV_COLUMNS |
                        SQL_ISV_KEY_COLUMN_USAGE |
@@ -346,7 +346,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
                        /* SQL_ISV_SCHEMATA | */ SQL_ISV_TABLE_CONSTRAINTS |
                        SQL_ISV_TABLE_PRIVILEGES | SQL_ISV_TABLES |
                        SQL_ISV_VIEWS);
-    else if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    else if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_ULONG(SQL_ISV_CHARACTER_SETS | SQL_ISV_COLLATIONS |
                        SQL_ISV_COLUMN_PRIVILEGES | SQL_ISV_COLUMNS |
                        SQL_ISV_KEY_COLUMN_USAGE | /* SQL_ISV_SCHEMATA | */
@@ -372,7 +372,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
      the MySQL Reference Manual (which is, in turn, generated from the source)
      with the pre-reserved ODBC keywords removed.
     */
-    if (is_minimum_version(dbc->mysql.server_version, "5.1", 3))
+      if (is_minimum_version(dbc->mysql.server_version, "5.1"))
       MYINFO_SET_STR("ACCESSIBLE,ANALYZE,ASENSITIVE,BEFORE,BIGINT,BINARY,BLOB,"
                      "CALL,CHANGE,CONDITION,DATABASE,DATABASES,DAY_HOUR,"
                      "DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DELAYED,"
@@ -394,7 +394,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
                      "TINYTEXT,TRIGGER,UNDO,UNLOCK,UNSIGNED,USE,UTC_DATE,"
                      "UTC_TIME,UTC_TIMESTAMP,VARBINARY,VARCHARACTER,WHILE,X509,"
                      "XOR,YEAR_MONTH,ZEROFILL");
-    else if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    else if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_STR("ANALYZE,ASENSITIVE,BEFORE,BIGINT,BINARY,BLOB,CALL,CHANGE,"
                      "CONDITION,DATABASE,DATABASES,DAY_HOUR,DAY_MICROSECOND,"
                      "DAY_MINUTE,DAY_SECOND,DELAYED,DETERMINISTIC,DISTINCTROW,"
@@ -479,7 +479,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
     MYINFO_SET_USHORT(NAME_LEN);
 
   case SQL_MAX_INDEX_SIZE:
-    if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_USHORT(3072);
     else
       MYINFO_SET_USHORT(1024);
@@ -503,7 +503,7 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
     MYINFO_SET_USHORT(NAME_LEN);
 
   case SQL_MAX_TABLES_IN_SELECT:
-    if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_USHORT(63);
     else
       MYINFO_SET_USHORT(31);
@@ -561,13 +561,13 @@ MySQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT
     MYINFO_SET_ULONG(SQL_PAS_NO_BATCH);
 
   case SQL_PROCEDURE_TERM:
-    if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_STR("stored procedure");
     else
       MYINFO_SET_STR("");
 
   case SQL_PROCEDURES:
-    if (is_minimum_version(dbc->mysql.server_version, "5.0", 3))
+    if (is_minimum_version(dbc->mysql.server_version, "5.0"))
       MYINFO_SET_STR("Y");
     else
       MYINFO_SET_STR("N");
Index: mysql-connector-odbc-5.1.8/driver/myutil.h
===================================================================
--- mysql-connector-odbc-5.1.8.orig/driver/myutil.h
+++ mysql-connector-odbc-5.1.8/driver/myutil.h
@@ -255,8 +255,7 @@ char *extend_buffer(NET *net,char *to,ul
 void myodbc_end();
 my_bool set_dynamic_result(STMT FAR *stmt);
 void set_current_cursor_data(STMT FAR *stmt,SQLUINTEGER irow);
-my_bool is_minimum_version(const char *server_version,const char *version,
-			   uint length);
+my_bool is_minimum_version(const char *server_version,const char *version);
 int myodbc_strcasecmp(const char *s, const char *t);
 int myodbc_casecmp(const char *s, const char *t, uint len);
 my_bool reget_current_catalog(DBC FAR *dbc);
Index: mysql-connector-odbc-5.1.8/driver/utility.c
===================================================================
--- mysql-connector-odbc-5.1.8.orig/driver/utility.c
+++ mysql-connector-odbc-5.1.8/driver/utility.c
@@ -2263,11 +2263,23 @@ void end_query_log(FILE *query_log)
 }
 
 
-my_bool is_minimum_version(const char *server_version,const char *version,
-                           uint length)
+my_bool is_minimum_version(const char *server_version,const char *version)
 {
-    if ( strncmp(server_version,version,length) >= 0 )
+    /* 
+    Variables have to be initialized if we don't want to get random 
+    values after sscanf
+    */
+    uint major1= 0, major2= 0, minor1= 0, minor2= 0, build1= 0, build2= 0;
+
+    sscanf(server_version, "%u.%u.%u", &major1, &minor1, &build1);
+    sscanf(version, "%u.%u.%u", &major2, &minor2, &build2);
+
+    if ( major1 > major2 ||
+         major1 == major2 && (minor1 > minor2 ||
+                              minor1 ==  minor2 && build1 >= build2))
+    {
         return TRUE;
+    }
     return FALSE;
 }
 
