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
e252af7b
Commit
e252af7b
authored
Dec 09, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reuse new safe_net_field_length_ll function where appropriate
parent
bec1d903
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
25 deletions
+10
-25
sql/sql_acl.cc
sql/sql_acl.cc
+10
-25
No files found.
sql/sql_acl.cc
View file @
e252af7b
...
@@ -11112,36 +11112,21 @@ static bool
...
@@ -11112,36 +11112,21 @@ static bool
read_client_connect_attrs
(
char
**
ptr
,
char
*
end
,
read_client_connect_attrs
(
char
**
ptr
,
char
*
end
,
const
CHARSET_INFO
*
from_cs
)
const
CHARSET_INFO
*
from_cs
)
{
{
size_t
length
,
length_length
;
size_t
length
;
size_t
max_bytes_available
=
end
-
*
ptr
;
char
*
ptr_save
=
*
ptr
;
/* not enough bytes to hold the length */
/* not enough bytes to hold the length */
if
(
(
*
ptr
)
>=
(
end
-
1
)
)
if
(
ptr_save
>=
end
)
return
true
;
return
true
;
/* read the length */
length
=
safe_net_field_length_ll
((
uchar
**
)
ptr
,
end
-
ptr_save
);
if
(
max_bytes_available
>=
9
)
{
/* cannot even read the length */
char
*
ptr_save
=
*
ptr
;
if
(
*
ptr
==
NULL
)
length
=
net_field_length_ll
((
uchar
**
)
ptr
);
length_length
=
*
ptr
-
ptr_save
;
DBUG_ASSERT
(
length_length
<=
9
);
}
else
{
/* to avoid reading unallocated and uninitialized memory */
char
buf
[
10
]
=
{
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,},
*
len_ptr
=
buf
;
memcpy
(
buf
,
*
ptr
,
max_bytes_available
);
length
=
net_field_length_ll
((
uchar
**
)
&
len_ptr
);
length_length
=
len_ptr
-
buf
;
*
ptr
+=
length_length
;
if
(
max_bytes_available
<
length_length
)
return
true
;
return
true
;
}
max_bytes_available
-=
length_length
;
/* length says there're more data than can fit into the packet */
/* length says there're more data than can fit into the packet */
if
(
length
>
max_bytes_available
)
if
(
*
ptr
+
length
>
end
)
return
true
;
return
true
;
/* impose an artificial length limit of 64k */
/* impose an artificial length limit of 64k */
...
...
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