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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
1e860400
Commit
1e860400
authored
May 15, 2004
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extra safety fixes (probably not needed, but can't hurt)
parent
7bcb79e7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
sql/ha_innodb.cc
sql/ha_innodb.cc
+3
-6
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
sql/sql_show.cc
sql/sql_show.cc
+1
-2
No files found.
sql/ha_innodb.cc
View file @
1e860400
...
@@ -395,12 +395,9 @@ innobase_mysql_print_thd(
...
@@ -395,12 +395,9 @@ innobase_mysql_print_thd(
but better be safe */
but better be safe */
}
}
for
(
i
=
0
;
i
<
len
&&
s
[
i
];
i
++
);
/* Use strmake to reduce the timeframe
memcpy
(
buf
,
s
,
i
);
/* Use memcpy to reduce the timeframe
for a race, compared to fwrite() */
for a race, compared to fwrite() */
buf
[
300
]
=
'\0'
;
/* not needed, just extra safety */
i
=
(
uint
)
(
strmake
(
buf
,
s
,
len
)
-
buf
);
putc
(
'\n'
,
f
);
putc
(
'\n'
,
f
);
fwrite
(
buf
,
1
,
i
,
f
);
fwrite
(
buf
,
1
,
i
,
f
);
}
}
...
...
sql/sql_parse.cc
View file @
1e860400
...
@@ -1067,6 +1067,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1067,6 +1067,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
packet_length
--
;
packet_length
--
;
}
}
/* We must allocate some extra memory for query cache */
/* We must allocate some extra memory for query cache */
thd
->
query_length
=
0
;
// Extra safety: Avoid races
if
(
!
(
thd
->
query
=
(
char
*
)
thd
->
memdup_w_gap
((
gptr
)
(
packet
),
if
(
!
(
thd
->
query
=
(
char
*
)
thd
->
memdup_w_gap
((
gptr
)
(
packet
),
packet_length
,
packet_length
,
thd
->
db_length
+
2
+
thd
->
db_length
+
2
+
...
@@ -2982,8 +2983,8 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
...
@@ -2982,8 +2983,8 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
{
{
DBUG_ENTER
(
"mysql_parse"
);
DBUG_ENTER
(
"mysql_parse"
);
mysql_init_query
(
thd
);
thd
->
query_length
=
length
;
thd
->
query_length
=
length
;
mysql_init_query
(
thd
);
if
(
query_cache_send_result_to_client
(
thd
,
inBuf
,
length
)
<=
0
)
if
(
query_cache_send_result_to_client
(
thd
,
inBuf
,
length
)
<=
0
)
{
{
LEX
*
lex
=
lex_start
(
thd
,
(
uchar
*
)
inBuf
,
length
);
LEX
*
lex
=
lex_start
(
thd
,
(
uchar
*
)
inBuf
,
length
);
...
...
sql/sql_show.cc
View file @
1e860400
...
@@ -1147,8 +1147,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
...
@@ -1147,8 +1147,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
races with query_length
races with query_length
*/
*/
uint
length
=
min
(
max_query_length
,
tmp
->
query_length
);
uint
length
=
min
(
max_query_length
,
tmp
->
query_length
);
thd_info
->
query
=
(
char
*
)
thd
->
memdup
(
tmp
->
query
,
length
+
1
);
thd_info
->
query
=
(
char
*
)
thd
->
strmake
(
tmp
->
query
,
length
);
thd_info
->
query
[
length
]
=
0
;
}
}
thread_infos
.
append
(
thd_info
);
thread_infos
.
append
(
thd_info
);
}
}
...
...
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