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
ce8f1b23
Commit
ce8f1b23
authored
Sep 18, 2000
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better use of fn_format() in ha_mysisam::restore() and ha_myisam::backup()
fixed buffer overflow in fn_format()
parent
e023159c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
26 deletions
+11
-26
mysys/mf_format.c
mysys/mf_format.c
+2
-1
sql/ha_myisam.cc
sql/ha_myisam.cc
+9
-25
No files found.
mysys/mf_format.c
View file @
ce8f1b23
...
@@ -53,7 +53,8 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
...
@@ -53,7 +53,8 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
name
+=
(
length
=
dirname_part
(
dev
,(
startpos
=
(
my_string
)
name
)));
name
+=
(
length
=
dirname_part
(
dev
,(
startpos
=
(
my_string
)
name
)));
if
(
length
==
0
||
flag
&
1
)
if
(
length
==
0
||
flag
&
1
)
{
{
(
void
)
strmov
(
dev
,
dsk
);
/* Use given directory */
(
void
)
strnmov
(
dev
,
dsk
,
sizeof
(
dev
)
-
2
);
/* Use given directory */
convert_dirname
(
dev
);
/* Fix to this OS */
convert_dirname
(
dev
);
/* Fix to this OS */
}
}
if
(
flag
&
8
)
if
(
flag
&
8
)
...
...
sql/ha_myisam.cc
View file @
ce8f1b23
...
@@ -333,21 +333,12 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
...
@@ -333,21 +333,12 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
HA_CHECK_OPT
tmp_check_opt
;
HA_CHECK_OPT
tmp_check_opt
;
char
*
backup_dir
=
thd
->
lex
.
backup_dir
;
char
*
backup_dir
=
thd
->
lex
.
backup_dir
;
char
src_path
[
FN_REFLEN
],
dst_path
[
FN_REFLEN
];
char
src_path
[
FN_REFLEN
],
dst_path
[
FN_REFLEN
];
int
backup_dir_len
=
strlen
(
backup_dir
);
char
*
table_name
=
table
->
real_name
;
char
*
table_name
=
table
->
real_name
;
int
table_name_len
=
strlen
(
table_name
);
if
(
!
fn_format
(
src_path
,
table_name
,
backup_dir
,
MI_NAME_DEXT
,
4
+
64
))
if
(
backup_dir_len
+
table_name_len
+
4
>=
FN_REFLEN
)
return
HA_ADMIN_INVALID
;
return
HA_ADMIN_INVALID
;
memcpy
(
src_path
,
backup_dir
,
backup_dir_len
);
char
*
p
=
src_path
+
backup_dir_len
;
*
p
++
=
'/'
;
memcpy
(
p
,
table_name
,
table_name_len
);
p
+=
table_name_len
;
*
p
=
0
;
fn_format
(
src_path
,
src_path
,
""
,
MI_NAME_DEXT
,
4
);
int
error
=
0
;
int
error
=
0
;
char
*
errmsg
=
""
;
c
onst
c
har
*
errmsg
=
""
;
if
(
my_copy
(
src_path
,
fn_format
(
dst_path
,
table
->
path
,
""
,
if
(
my_copy
(
src_path
,
fn_format
(
dst_path
,
table
->
path
,
""
,
MI_NAME_DEXT
,
4
),
MYF
(
MY_WME
)))
MI_NAME_DEXT
,
4
),
MYF
(
MY_WME
)))
...
@@ -378,28 +369,21 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
...
@@ -378,28 +369,21 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
{
{
char
*
backup_dir
=
thd
->
lex
.
backup_dir
;
char
*
backup_dir
=
thd
->
lex
.
backup_dir
;
char
src_path
[
FN_REFLEN
],
dst_path
[
FN_REFLEN
];
char
src_path
[
FN_REFLEN
],
dst_path
[
FN_REFLEN
];
int
backup_dir_len
=
strlen
(
backup_dir
);
char
*
table_name
=
table
->
real_name
;
char
*
table_name
=
table
->
real_name
;
int
table_name_len
=
strlen
(
table_name
);
if
(
!
fn_format
(
dst_path
,
table_name
,
backup_dir
,
reg_ext
,
4
+
64
))
if
(
backup_dir_len
+
table_name_len
+
4
>=
FN_REFLEN
)
return
HA_ADMIN_INVALID
;
return
HA_ADMIN_INVALID
;
memcpy
(
dst_path
,
backup_dir
,
backup_dir_len
);
char
*
p
=
dst_path
+
backup_dir_len
;
*
p
++
=
'/'
;
memcpy
(
p
,
table_name
,
table_name_len
);
p
+=
table_name_len
;
*
p
=
0
;
if
(
my_copy
(
fn_format
(
src_path
,
table
->
path
,
""
,
reg_ext
,
4
),
if
(
my_copy
(
fn_format
(
src_path
,
table
->
path
,
""
,
reg_ext
,
4
),
fn_format
(
dst_path
,
dst_path
,
""
,
reg_ext
,
4
)
,
dst_path
,
MYF
(
MY_WME
|
MY_HOLD_ORIGINAL_MODES
)))
MYF
(
MY_WME
|
MY_HOLD_ORIGINAL_MODES
)))
{
{
return
HA_ADMIN_FAILED
;
return
HA_ADMIN_FAILED
;
}
}
*
p
=
0
;
if
(
!
fn_format
(
dst_path
,
table_name
,
backup_dir
,
MI_NAME_DEXT
,
4
+
64
))
*
(
fn_ext
(
src_path
))
=
0
;
return
HA_ADMIN_INVALID
;
if
(
my_copy
(
fn_format
(
src_path
,
src_path
,
""
,
MI_NAME_DEXT
,
4
),
fn_format
(
dst_path
,
dst_path
,
""
,
MI_NAME_DEXT
,
4
),
if
(
my_copy
(
fn_format
(
src_path
,
table
->
path
,
""
,
MI_NAME_DEXT
,
4
),
dst_path
,
MYF
(
MY_WME
|
MY_HOLD_ORIGINAL_MODES
))
)
MYF
(
MY_WME
|
MY_HOLD_ORIGINAL_MODES
))
)
return
HA_ADMIN_FAILED
;
return
HA_ADMIN_FAILED
;
...
...
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