Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
25aced9f
Unverified
Commit
25aced9f
authored
Jun 22, 2018
by
Donghwa Jeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btrfs: add to check return size of strlcat
Signed-off-by:
Donghwa Jeong
<
dh48.jeong@samsung.com
>
parent
ebcd5140
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
btrfs.c
src/lxc/storage/btrfs.c
+17
-3
No files found.
src/lxc/storage/btrfs.c
View file @
25aced9f
...
@@ -63,7 +63,7 @@ char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name,
...
@@ -63,7 +63,7 @@ char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name,
{
{
struct
btrfs_ioctl_ino_lookup_args
args
;
struct
btrfs_ioctl_ino_lookup_args
args
;
int
ret
,
e
;
int
ret
,
e
;
size_t
len
;
size_t
len
,
retlen
;
char
*
retpath
;
char
*
retpath
;
memset
(
&
args
,
0
,
sizeof
(
args
));
memset
(
&
args
,
0
,
sizeof
(
args
));
...
@@ -95,16 +95,30 @@ char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name,
...
@@ -95,16 +95,30 @@ char *get_btrfs_subvol_path(int fd, u64 dir_id, u64 objid, char *name,
(
void
)
strlcpy
(
retpath
,
args
.
name
,
len
);
(
void
)
strlcpy
(
retpath
,
args
.
name
,
len
);
(
void
)
strlcat
(
retpath
,
"/"
,
len
);
(
void
)
strlcat
(
retpath
,
"/"
,
len
);
(
void
)
strlcat
(
retpath
,
name
,
len
);
retlen
=
strlcat
(
retpath
,
name
,
len
);
if
(
retlen
>=
len
)
{
ERROR
(
"Failed to append name - %s
\n
"
,
name
);
free
(
retpath
);
return
NULL
;
}
}
else
{
}
else
{
/* we're at the root of ref_tree */
/* we're at the root of ref_tree */
len
=
name_len
+
1
;
len
=
name_len
+
1
;
retpath
=
malloc
(
len
);
retpath
=
malloc
(
len
);
if
(
!
retpath
)
if
(
!
retpath
)
return
NULL
;
return
NULL
;
*
retpath
=
'\0'
;
*
retpath
=
'\0'
;
(
void
)
strlcat
(
retpath
,
name
,
len
);
retlen
=
strlcat
(
retpath
,
name
,
len
);
if
(
retlen
>=
len
)
{
ERROR
(
"Failed to append name - %s
\n
"
,
name
);
free
(
retpath
);
return
NULL
;
}
}
}
return
retpath
;
return
retpath
;
}
}
...
...
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