diff options
author | unknown <monty@mashka.mysql.fi> | 2002-12-26 18:26:37 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-12-26 18:26:37 +0200 |
commit | f1696d4f5f001d59204f19b2ef3fa921c9336a0f (patch) | |
tree | 52c14204adc0f3d7ef9707add0e6d1da72ed37d8 /sql/item_create.cc | |
parent | ad22d0cbacd59f7dcac4ccc121486c614e609b93 (diff) | |
download | mariadb-git-f1696d4f5f001d59204f19b2ef3fa921c9336a0f.tar.gz |
Cut hostnames at HOSTNAME_LENGTH to avoid theoretical hostname overruns
Changed long packat handling to check for packets of length 0xffffff.
This does however break packet handling for older clients.
If you are using packets >= 16M then you need to upgrade client and server
after this patch.
Docs/internals.texi:
Updated documentation for 4.1 protocol
sql/ha_innodb.cc:
Optimization of checking command
sql/item.h:
Removed automatic set of length for Item_string
sql/item_create.cc:
Optimized create of create_func_current_user()
sql/net_serv.cc:
Fixed wrong max packet length
sql/sql_acl.cc:
Safety fix.
sql/sql_parse.cc:
Cut hostnames at HOSTNAME_LENGTH to avoid theoretical hostname overruns
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index 1f0bad8eda3..c6fca1c01e1 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -294,10 +294,12 @@ Item *create_func_pow(Item* a, Item *b) Item *create_func_current_user() { THD *thd=current_thd; - Item_string *res=new Item_string("CURRENT_USER()", thd->priv_user, 0); - res->append("@", 1); - res->append((char *)thd->host_or_ip, 0); - return res; + char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + uint length; + + length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) - + buff); + return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length); } Item *create_func_quarter(Item* a) @@ -403,7 +405,7 @@ Item *create_func_ucase(Item* a) Item *create_func_version(void) { - return new Item_string("VERSION()",server_version, 0); + return new Item_string("VERSION()",server_version, strlen(server_version)); } Item *create_func_weekday(Item* a) |