diff options
author | unknown <pem@mysql.com> | 2006-02-16 13:40:37 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2006-02-16 13:40:37 +0100 |
commit | 8dd6e1454a0cf0cc4e974c9dd8f71e77cf7e8a68 (patch) | |
tree | c545690e7a67a8afc9456423d6cf37191acd7919 /sql/sp.cc | |
parent | 3f4c176caeb5e1f9b2d56ab7536d0931bcafe76c (diff) | |
download | mariadb-git-8dd6e1454a0cf0cc4e974c9dd8f71e77cf7e8a68.tar.gz |
Fixed BUG#17015: Routine name truncation not an error
The name length was checked "the old way", not taking charsets into account,
when creating a stored routine.
Fixing this enforces the real limit (64 characters) again, and no truncation
is possible.
mysql-test/r/sp-error.result:
Updated results for BUG#17015.
mysql-test/t/sp-error.test:
Added and modified test case for BUG#17015 (and 9529).
sql/sp.cc:
When creating a routine, check the length of the name the correct way,
taking the charsets into account.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index fe249141fea..53218aece56 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -508,7 +508,12 @@ db_create_routine(THD *thd, int type, sp_head *sp) ret= SP_GET_FIELD_FAILED; goto done; } - if (sp->m_name.length > table->field[MYSQL_PROC_FIELD_NAME]->field_length) + + if ((system_charset_info->cset->numchars(system_charset_info, + sp->m_name.str, + sp->m_name.str+sp->m_name.length) * + table->field[MYSQL_PROC_FIELD_NAME]->charset()->mbmaxlen) > + table->field[MYSQL_PROC_FIELD_NAME]->field_length) { ret= SP_BAD_IDENTIFIER; goto done; |