diff options
author | unknown <pem@mysql.com> | 2006-01-11 15:11:05 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2006-01-11 15:11:05 +0100 |
commit | 1e968057523db1313438368812b99a38ba460542 (patch) | |
tree | 702391a280a23dfee13efd2028892e83aef26525 /sql/sp_head.cc | |
parent | 935ad7e8f376805f435d6e105d337efb54a31379 (diff) | |
download | mariadb-git-1e968057523db1313438368812b99a38ba460542.tar.gz |
Fixing BUG#15658: Server crashes after creating function as empty string
Empty strings (and names with trailing spaces) should not be allowed.
mysql-test/r/sp-error.result:
New testcase for BUG#15658
mysql-test/t/sp-error.test:
New testcase for BUG#15658
sql/share/errmsg.txt:
New error message for bad stored routine names.
sql/sp_head.cc:
Added function for checking SP names. (Mustn't be empty or contain trailing spaces.)
sql/sp_head.h:
Added function for checking SP names.
sql/sql_yacc.yy:
Check db and name for stored routines.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 12f9260e7b1..bf1de53acd6 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -384,6 +384,23 @@ sp_name_current_db_new(THD *thd, LEX_STRING name) return qname; } +/* + * Check that the name 'ident' is ok. It's assumed to be an 'ident' + * from the parser, so we only have to check length and trailing spaces. + * The former is a standard requirement (and 'show status' assumes a + * non-empty name), the latter is a mysql:ism as trailing spaces are + * removed by get_field(). + * + * RETURN + * TRUE - bad name + * FALSE - name is ok + */ + +bool +sp_name_check(LEX_STRING ident) +{ + return (!ident.str || !ident.str[0] || ident.str[ident.length-1] == ' '); +} /* ------------------------------------------------------------------ */ |