Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8ba33d7d
Commit
8ba33d7d
authored
Mar 16, 2004
by
gluh@gluh.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug#2586 Disallow global/session/local as structured var. instance names
parent
ac8c1cc4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
0 deletions
+48
-0
mysql-test/r/variables.result
mysql-test/r/variables.result
+10
-0
mysql-test/t/variables.test
mysql-test/t/variables.test
+14
-0
sql/item_func.cc
sql/item_func.cc
+16
-0
sql/mysql_priv.h
sql/mysql_priv.h
+3
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-0
No files found.
mysql-test/r/variables.result
View file @
8ba33d7d
...
...
@@ -406,3 +406,13 @@ set @a=@b, @b=@a;
select @a, @b;
@a @b
2 1
set @@global.global.key_buffer_size= 1;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
set GLOBAL global.key_buffer_size= 1;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
SELECT @@global.global.key_buffer_size;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
SELECT @@global.session.key_buffer_size;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
SELECT @@global.local.key_buffer_size;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
mysql-test/t/variables.test
View file @
8ba33d7d
...
...
@@ -285,3 +285,17 @@ select @@global.max_user_connections,@@local.max_join_size;
set
@
a
=
1
,
@
b
=
2
;
set
@
a
=@
b
,
@
b
=@
a
;
select
@
a
,
@
b
;
#
# Bug#2586:Disallow global/session/local as structured var. instance names
#
--
error
1149
set
@@
global
.
global
.
key_buffer_size
=
1
;
--
error
1149
set
GLOBAL
global
.
key_buffer_size
=
1
;
--
error
1149
SELECT
@@
global
.
global
.
key_buffer_size
;
--
error
1149
SELECT
@@
global
.
session
.
key_buffer_size
;
--
error
1149
SELECT
@@
global
.
local
.
key_buffer_size
;
sql/item_func.cc
View file @
8ba33d7d
...
...
@@ -29,6 +29,16 @@
#include <ft_global.h>
bool
check_reserved_words
(
LEX_STRING
*
name
)
{
if
(
!
my_strcasecmp
(
system_charset_info
,
name
->
str
,
"GLOBAL"
)
||
!
my_strcasecmp
(
system_charset_info
,
name
->
str
,
"LOCAL"
)
||
!
my_strcasecmp
(
system_charset_info
,
name
->
str
,
"SESSION"
))
return
TRUE
;
return
FALSE
;
}
static
void
my_coll_agg_error
(
DTCollation
&
c1
,
DTCollation
&
c2
,
const
char
*
fname
)
{
...
...
@@ -2957,6 +2967,12 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
(
uint
)
strlen
(
server_version
),
system_charset_info
);
if
(
name
.
str
&&
component
.
str
&&
check_reserved_words
(
&
name
))
{
net_printf
(
thd
,
ER_SYNTAX_ERROR
);
return
0
;
}
Item
*
item
;
sys_var
*
var
;
char
buff
[
MAX_SYS_VAR_LENGTH
*
2
+
4
+
8
],
*
pos
;
...
...
sql/mysql_priv.h
View file @
8ba33d7d
...
...
@@ -751,6 +751,9 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
/* mysqld.cc */
extern
void
yyerror
(
const
char
*
);
/* item_func.cc */
extern
bool
check_reserved_words
(
LEX_STRING
*
name
);
/* strfunc.cc */
ulonglong
find_set
(
TYPELIB
*
typelib
,
const
char
*
x
,
uint
length
,
char
**
err_pos
,
uint
*
err_len
,
bool
*
set_warning
);
...
...
sql/sql_yacc.yy
View file @
8ba33d7d
...
...
@@ -5034,6 +5034,11 @@ internal_variable_name:
}
| ident '.' ident
{
if (check_reserved_words(&$1))
{
net_printf(YYTHD, ER_SYNTAX_ERROR);
YYABORT;
}
sys_var *tmp=find_sys_var($3.str, $3.length);
if (!tmp)
YYABORT;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment