summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 7f77e60138b..98d17fdd318 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -537,13 +537,13 @@ err1:
bool load_db_opt_by_name(THD *thd, const char *db_name,
HA_CREATE_INFO *db_create_info)
{
- char db_opt_path[FN_REFLEN];
+ char db_opt_path[FN_REFLEN + 1];
/*
Pass an empty file name, and the database options file name as extension
to avoid table name to file name encoding.
*/
- (void) build_table_filename(db_opt_path, sizeof(db_opt_path),
+ (void) build_table_filename(db_opt_path, sizeof(db_opt_path) - 1,
db_name, "", MY_DB_OPT_FILE, 0);
return load_db_opt(thd, db_opt_path, db_create_info);
@@ -645,7 +645,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
/* Check directory */
- path_len= build_table_filename(path, sizeof(path), db, "", "", 0);
+ path_len= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
path[path_len-1]= 0; // Remove last '/' from path
if (my_stat(path,&stat_info,MYF(0)))
@@ -791,7 +791,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
We pass MY_DB_OPT_FILE as "extension" to avoid
"table name to file name" encoding.
*/
- build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE, 0);
+ build_table_filename(path, sizeof(path) - 1, db, "", MY_DB_OPT_FILE, 0);
if ((error=write_db_opt(thd, path, create_info)))
goto exit;
@@ -884,7 +884,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
- length= build_table_filename(path, sizeof(path), db, "", "", 0);
+ length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
del_dbopt(path); // Remove dboption hash entry
path[length]= '\0'; // Remove file name
@@ -1841,7 +1841,7 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
for (uint idx=0 ; idx < nfiles && !thd->killed ; idx++)
{
FILEINFO *file= dirp->dir_entry + idx;
- char *extension, tname[FN_REFLEN];
+ char *extension, tname[FN_REFLEN + 1];
LEX_STRING table_str;
DBUG_PRINT("info",("Examining: %s", file->name));
@@ -1930,7 +1930,7 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
for (uint idx=0 ; idx < nfiles ; idx++)
{
FILEINFO *file= dirp->dir_entry + idx;
- char oldname[FN_REFLEN], newname[FN_REFLEN];
+ char oldname[FN_REFLEN + 1], newname[FN_REFLEN + 1];
DBUG_PRINT("info",("Examining: %s", file->name));
/* skiping . and .. and MY_DB_OPT_FILE */
@@ -2000,10 +2000,10 @@ exit:
bool check_db_dir_existence(const char *db_name)
{
- char db_dir_path[FN_REFLEN];
+ char db_dir_path[FN_REFLEN + 1];
uint db_dir_path_len;
- db_dir_path_len= build_table_filename(db_dir_path, sizeof(db_dir_path),
+ db_dir_path_len= build_table_filename(db_dir_path, sizeof(db_dir_path) - 1,
db_name, "", "", 0);
if (db_dir_path_len && db_dir_path[db_dir_path_len - 1] == FN_LIBCHAR)