mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-10 06:37:29 +00:00
policycoreutils: setfiles: Fix potential crash using dereferenced ftsent
If fts_read() fails for any reason ftsent will be NULL. Previously we would have reported the error and then continued processing. Now we report the error and stop using the NULL pointer. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
a2db3f2df8
commit
f23e078018
@ -318,11 +318,16 @@ static int process_one(char *name, int recurse_this_path)
|
||||
|
||||
|
||||
ftsent = fts_read(fts_handle);
|
||||
if (ftsent != NULL) {
|
||||
/* Keep the inode of the first one. */
|
||||
dev_num = ftsent->fts_statp->st_dev;
|
||||
if (ftsent == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: error while labeling %s: %s\n",
|
||||
r_opts->progname, namelist[0], strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Keep the inode of the first one. */
|
||||
dev_num = ftsent->fts_statp->st_dev;
|
||||
|
||||
do {
|
||||
rc = 0;
|
||||
/* Skip the post order nodes. */
|
||||
|
Loading…
Reference in New Issue
Block a user