Commit 24424453 authored by unknown's avatar unknown

bug with mysql_change_db() fixed


BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 14aa6b46
...@@ -2,3 +2,4 @@ jani@hynda.mysql.fi ...@@ -2,3 +2,4 @@ jani@hynda.mysql.fi
heikki@donna.mysql.fi heikki@donna.mysql.fi
monty@donna.mysql.fi monty@donna.mysql.fi
paul@central.snake.net paul@central.snake.net
serg@serg.mysql.com
...@@ -13726,7 +13726,7 @@ in ANSI mode. @xref{ANSI mode}. ...@@ -13726,7 +13726,7 @@ in ANSI mode. @xref{ANSI mode}.
@multitable @columnfractions .15 .15 .70 @multitable @columnfractions .15 .15 .70
@item @strong{Identifier} @tab @strong{Max length} @tab @strong{Allowed characters} @item @strong{Identifier} @tab @strong{Max length} @tab @strong{Allowed characters}
@item Database @tab 64 @tab Any character that is allowed in a directory name except @samp{/}. @item Database @tab 64 @tab Any character that is allowed in a directory name except @samp{/} or @samp{.}.
@item Table @tab 64 @tab Any character that is allowed in a file name, except @samp{/} or @samp{.}. @item Table @tab 64 @tab Any character that is allowed in a file name, except @samp{/} or @samp{.}.
@item Column @tab 64 @tab All characters. @item Column @tab 64 @tab All characters.
@item Alias @tab 255 @tab All characters. @item Alias @tab 255 @tab All characters.
...@@ -264,9 +264,10 @@ bool mysql_change_db(THD *thd,const char *name) ...@@ -264,9 +264,10 @@ bool mysql_change_db(THD *thd,const char *name)
send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */ send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
if (length > NAME_LEN) if ((length > NAME_LEN) || check_db_name(dbname))
{ {
net_printf(&thd->net,ER_WRONG_DB_NAME, dbname); net_printf(&thd->net,ER_WRONG_DB_NAME, dbname);
x_free(dbname);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_PRINT("general",("Use database: %s", dbname)); DBUG_PRINT("general",("Use database: %s", dbname));
......
...@@ -1052,7 +1052,7 @@ bool check_db_name(const char *name) ...@@ -1052,7 +1052,7 @@ bool check_db_name(const char *name)
} }
} }
#endif #endif
if (*name == '/' || *name == FN_LIBCHAR) if (*name == '/' || *name == FN_LIBCHAR || *name == FN_EXTCHAR)
return 1; return 1;
name++; name++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment