summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2005-05-31 18:36:32 +0200
committerunknown <pem@mysql.comhem.se>2005-05-31 18:36:32 +0200
commit3f7b0f708e046d0a5ffe0ef96c1f52471be7b397 (patch)
tree151c51e4a5a263cada0599bd33881110da8caf0b /sql/sp.cc
parent190aafb4d9760976b212db51f2f56c41f16cc376 (diff)
downloadmariadb-git-3f7b0f708e046d0a5ffe0ef96c1f52471be7b397.tar.gz
Fixed BUG#9529: Stored Procedures: No Warning on truncation of procedure name
during creation. Although it returns an error, consistent with the behaviour for other objects. (Unclear why we would allow the creation of SPs with truncated names.) mysql-test/r/sp-error.result: New test case for BUG#9529. mysql-test/t/sp-error.test: New test case for BUG#9529. sql/sp.cc: Check SP name length on creation (and drop). sql/sp.h: New status code for bad (too long) name. sql/sql_parse.cc: New status code for bad (too long) name.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index a5b1f062456..4f89d6ba6da 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -120,6 +120,10 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
'db', 'name' and 'type' and the first key is the primary key over the
same fields.
*/
+ if (name->m_name.length > table->field[1]->field_length)
+ {
+ DBUG_RETURN(SP_KEY_NOT_FOUND);
+ }
table->field[0]->store(name->m_db.str, name->m_db.length, &my_charset_bin);
table->field[1]->store(name->m_name.str, name->m_name.length,
&my_charset_bin);
@@ -389,6 +393,11 @@ 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)
+ {
+ ret= SP_BAD_IDENTIFIER;
+ goto done;
+ }
table->field[MYSQL_PROC_FIELD_DB]->
store(sp->m_db.str, sp->m_db.length, system_charset_info);
table->field[MYSQL_PROC_FIELD_NAME]->