=== modified file 'storage/innobase/handler/ha_innodb.cc' --- storage/innobase/handler/ha_innodb.cc 2015-01-21 13:33:39 +0000 +++ storage/innobase/handler/ha_innodb.cc 2015-02-18 11:02:19 +0000 @@ -14645,20 +14645,59 @@ int len = sizeof(buff); trx_t* trx; int ret = 1; + char path[FN_REFLEN + 1]; + const char* real_name; ut_a(save != NULL); ut_a(value != NULL); stopword_table_name = value->val_str(value, buff, &len); + real_name = stopword_table_name; trx = check_trx_exists(thd); row_mysql_lock_data_dictionary(trx); + if (stopword_table_name) { + int length; + char db[FN_REFLEN + 1], table[FN_REFLEN + 1]; + const char* slash; + + slash = strstr(stopword_table_name,"/"); + memset(path, 0, sizeof(path)); + + if (slash) { + memset(db, 0, sizeof(db)); + memset(table, 0, sizeof(table)); + strncpy(db, stopword_table_name, slash-stopword_table_name); + strcpy(table, slash+1); + } else { + db[0]='\0'; + strcpy(table, stopword_table_name); + } + + length = build_table_filename(path, sizeof(path) - 1, db, table, "", 0); + + if (length > FN_REFLEN) { + *static_cast(save) = stopword_table_name; + ret = 0; + } + + slash = path; + /* Find the last occurrence of db name */ + do { + slash = strstr(slash, db); + if (slash) { + real_name = slash; + slash+=strlen(db); + } + } while (slash); + } + /* Validate the stopword table's (if supplied) existence and of the right format */ if (!stopword_table_name - || fts_valid_stopword_table(stopword_table_name)) { + || fts_valid_stopword_table(real_name)) { *static_cast(save) = stopword_table_name; ret = 0; }