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
0b382e93
Unverified
Commit
0b382e93
authored
Mar 25, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: fix set_config_sysctl()
Link:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32487
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
54b0023f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
confile.c
src/lxc/confile.c
+9
-8
No files found.
src/lxc/confile.c
View file @
0b382e93
...
@@ -1836,35 +1836,36 @@ static int set_config_sysctl(const char *key, const char *value,
...
@@ -1836,35 +1836,36 @@ static int set_config_sysctl(const char *key, const char *value,
return
-
1
;
return
-
1
;
key
+=
STRLITERALLEN
(
"lxc.sysctl."
);
key
+=
STRLITERALLEN
(
"lxc.sysctl."
);
if
(
is_empty_string
(
key
))
return
ret_errno
(
-
EINVAL
);
/* find existing list element */
/* find existing list element */
lxc_list_for_each
(
iter
,
&
lxc_conf
->
sysctls
)
{
lxc_list_for_each
(
iter
,
&
lxc_conf
->
sysctls
)
{
__do_free
char
*
replace_value
=
NULL
;
__do_free
char
*
replace_value
=
NULL
;
struct
lxc_sysctl
*
cur
=
iter
->
elem
;
sysctl_elem
=
iter
->
elem
;
if
(
!
strequal
(
key
,
cur
->
key
))
if
(
!
strequal
(
key
,
sysctl_elem
->
key
))
continue
;
continue
;
replace_value
=
strdup
(
value
);
replace_value
=
strdup
(
value
);
if
(
!
replace_value
)
if
(
!
replace_value
)
return
ret_errno
(
EINVAL
);
return
ret_errno
(
EINVAL
);
free
(
sysctl_elem
->
value
);
free
(
cur
->
value
);
sysctl_elem
->
value
=
move_ptr
(
replace_value
);
cur
->
value
=
move_ptr
(
replace_value
);
return
0
;
return
0
;
}
}
/* allocate list element */
/* allocate list element */
sysctl_list
=
m
alloc
(
sizeof
(
*
sysctl_list
));
sysctl_list
=
z
alloc
(
sizeof
(
*
sysctl_list
));
if
(
!
sysctl_list
)
if
(
!
sysctl_list
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
lxc_list_init
(
sysctl_list
);
sysctl_elem
=
m
alloc
(
sizeof
(
*
sysctl_elem
));
sysctl_elem
=
z
alloc
(
sizeof
(
*
sysctl_elem
));
if
(
!
sysctl_elem
)
if
(
!
sysctl_elem
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
memset
(
sysctl_elem
,
0
,
sizeof
(
*
sysctl_elem
));
sysctl_elem
->
key
=
strdup
(
key
);
sysctl_elem
->
key
=
strdup
(
key
);
if
(
!
sysctl_elem
->
key
)
if
(
!
sysctl_elem
->
key
)
...
...
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