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
e97dfb8c
Unverified
Commit
e97dfb8c
authored
Aug 06, 2018
by
2xsec
Committed by
Christian Brauner
Aug 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: #1438231
Dereference after null check Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
eae95dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
pam_cgfs.c
src/lxc/pam/pam_cgfs.c
+12
-2
No files found.
src/lxc/pam/pam_cgfs.c
View file @
e97dfb8c
...
@@ -1558,7 +1558,7 @@ static bool get_uid_gid(const char *user, uid_t *uid, gid_t *gid)
...
@@ -1558,7 +1558,7 @@ static bool get_uid_gid(const char *user, uid_t *uid, gid_t *gid)
if
(
!
pwentp
)
{
if
(
!
pwentp
)
{
if
(
ret
==
0
)
if
(
ret
==
0
)
mysyslog
(
LOG_ERR
,
mysyslog
(
LOG_ERR
,
"Could not find matched password record
\n
"
,
NULL
);
"Could not find matched password record
\n
"
,
NULL
);
free
(
buf
);
free
(
buf
);
return
false
;
return
false
;
...
@@ -1610,6 +1610,7 @@ static uint32_t *cg_cpumask(char *buf, size_t nbits)
...
@@ -1610,6 +1610,7 @@ static uint32_t *cg_cpumask(char *buf, size_t nbits)
char
*
range
=
strchr
(
token
,
'-'
);
char
*
range
=
strchr
(
token
,
'-'
);
if
(
range
)
if
(
range
)
end
=
strtoul
(
range
+
1
,
NULL
,
0
);
end
=
strtoul
(
range
+
1
,
NULL
,
0
);
if
(
!
(
start
<=
end
))
{
if
(
!
(
start
<=
end
))
{
free
(
bitarr
);
free
(
bitarr
);
return
NULL
;
return
NULL
;
...
@@ -1678,9 +1679,11 @@ static char *cg_cpumask_to_cpulist(uint32_t *bitarr, size_t nbits)
...
@@ -1678,9 +1679,11 @@ static char *cg_cpumask_to_cpulist(uint32_t *bitarr, size_t nbits)
free_string_list
(
cpulist
);
free_string_list
(
cpulist
);
return
NULL
;
return
NULL
;
}
}
must_append_string
(
&
cpulist
,
numstr
);
must_append_string
(
&
cpulist
,
numstr
);
}
}
}
}
return
string_join
(
","
,
(
const
char
**
)
cpulist
,
false
);
return
string_join
(
","
,
(
const
char
**
)
cpulist
,
false
);
}
}
...
@@ -1703,10 +1706,12 @@ static ssize_t cg_get_max_cpus(char *cpulist)
...
@@ -1703,10 +1706,12 @@ static ssize_t cg_get_max_cpus(char *cpulist)
else
if
(
c1
<
c2
)
else
if
(
c1
<
c2
)
c1
=
c2
;
c1
=
c2
;
if
(
!
c1
)
return
-
1
;
/* If the above logic is correct, c1 should always hold a valid string
/* If the above logic is correct, c1 should always hold a valid string
* here.
* here.
*/
*/
errno
=
0
;
errno
=
0
;
cpus
=
strtoul
(
c1
,
NULL
,
0
);
cpus
=
strtoul
(
c1
,
NULL
,
0
);
if
(
errno
!=
0
)
if
(
errno
!=
0
)
...
@@ -1718,10 +1723,12 @@ static ssize_t cg_get_max_cpus(char *cpulist)
...
@@ -1718,10 +1723,12 @@ static ssize_t cg_get_max_cpus(char *cpulist)
static
ssize_t
write_nointr
(
int
fd
,
const
void
*
buf
,
size_t
count
)
static
ssize_t
write_nointr
(
int
fd
,
const
void
*
buf
,
size_t
count
)
{
{
ssize_t
ret
;
ssize_t
ret
;
again:
again:
ret
=
write
(
fd
,
buf
,
count
);
ret
=
write
(
fd
,
buf
,
count
);
if
(
ret
<
0
&&
errno
==
EINTR
)
if
(
ret
<
0
&&
errno
==
EINTR
)
goto
again
;
goto
again
;
return
ret
;
return
ret
;
}
}
...
@@ -1733,16 +1740,19 @@ static int write_to_file(const char *filename, const void* buf, size_t count, bo
...
@@ -1733,16 +1740,19 @@ static int write_to_file(const char *filename, const void* buf, size_t count, bo
fd
=
open
(
filename
,
O_WRONLY
|
O_TRUNC
|
O_CREAT
|
O_CLOEXEC
,
0666
);
fd
=
open
(
filename
,
O_WRONLY
|
O_TRUNC
|
O_CREAT
|
O_CLOEXEC
,
0666
);
if
(
fd
<
0
)
if
(
fd
<
0
)
return
-
1
;
return
-
1
;
ret
=
write_nointr
(
fd
,
buf
,
count
);
ret
=
write_nointr
(
fd
,
buf
,
count
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
out_error
;
goto
out_error
;
if
((
size_t
)
ret
!=
count
)
if
((
size_t
)
ret
!=
count
)
goto
out_error
;
goto
out_error
;
if
(
add_newline
)
{
if
(
add_newline
)
{
ret
=
write_nointr
(
fd
,
"
\n
"
,
1
);
ret
=
write_nointr
(
fd
,
"
\n
"
,
1
);
if
(
ret
!=
1
)
if
(
ret
!=
1
)
goto
out_error
;
goto
out_error
;
}
}
close
(
fd
);
close
(
fd
);
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