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
b9144ed2
Unverified
Commit
b9144ed2
authored
Oct 17, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: fix append_unexp_config_line()
Reported-by: 2xsec dh48.jeong@samsung.com Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f50a0b96
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
confile.c
src/lxc/confile.c
+8
-6
No files found.
src/lxc/confile.c
View file @
b9144ed2
...
@@ -1889,10 +1889,12 @@ static int set_config_console_size(const char *key, const char *value,
...
@@ -1889,10 +1889,12 @@ static int set_config_console_size(const char *key, const char *value,
int
append_unexp_config_line
(
const
char
*
line
,
struct
lxc_conf
*
conf
)
int
append_unexp_config_line
(
const
char
*
line
,
struct
lxc_conf
*
conf
)
{
{
size_t
len
=
conf
->
unexpanded_len
,
linelen
=
strlen
(
line
);
size_t
linelen
;
size_t
len
=
conf
->
unexpanded_len
;
update_hwaddr
(
line
);
update_hwaddr
(
line
);
linelen
=
strlen
(
line
);
while
(
conf
->
unexpanded_alloced
<=
len
+
linelen
+
2
)
{
while
(
conf
->
unexpanded_alloced
<=
len
+
linelen
+
2
)
{
char
*
tmp
=
realloc
(
conf
->
unexpanded_config
,
char
*
tmp
=
realloc
(
conf
->
unexpanded_config
,
conf
->
unexpanded_alloced
+
1024
);
conf
->
unexpanded_alloced
+
1024
);
...
@@ -1901,16 +1903,16 @@ int append_unexp_config_line(const char *line, struct lxc_conf *conf)
...
@@ -1901,16 +1903,16 @@ int append_unexp_config_line(const char *line, struct lxc_conf *conf)
if
(
!
conf
->
unexpanded_config
)
if
(
!
conf
->
unexpanded_config
)
*
tmp
=
'\0'
;
*
tmp
=
'\0'
;
conf
->
unexpanded_config
=
tmp
;
conf
->
unexpanded_config
=
tmp
;
conf
->
unexpanded_alloced
+=
1024
;
conf
->
unexpanded_alloced
+=
1024
;
}
}
(
void
)
strlcat
(
conf
->
unexpanded_config
,
line
,
conf
->
unexpanded_alloced
);
memcpy
(
conf
->
unexpanded_config
+
conf
->
unexpanded_len
,
line
,
linelen
);
conf
->
unexpanded_len
+=
linelen
;
conf
->
unexpanded_len
+=
linelen
;
if
(
line
[
linelen
-
1
]
!=
'\n'
)
{
if
(
line
[
linelen
-
1
]
!=
'\n'
)
(
void
)
strlcat
(
conf
->
unexpanded_config
,
"
\n
"
,
conf
->
unexpanded_alloced
);
conf
->
unexpanded_config
[
conf
->
unexpanded_len
++
]
=
'\n'
;
conf
->
unexpanded_len
++
;
conf
->
unexpanded_config
[
conf
->
unexpanded_len
]
=
'\0'
;
}
return
0
;
return
0
;
}
}
...
...
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