Skip to content

Commit

Permalink
libsemanage: handle shell allocation failure
Browse files Browse the repository at this point in the history
Return failure instead of silently using a fallback.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
  • Loading branch information
cgzones authored and bachradsusi committed Nov 27, 2024
1 parent 419a76e commit dcd755a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libsemanage/src/genhomedircon.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static semanage_list_t *get_shell_list(void)
free(temp);
semanage_list_destroy(&list);
fclose(shells);
return default_shell_list();
return NULL;
}
}
}
Expand Down Expand Up @@ -333,7 +333,10 @@ static semanage_list_t *get_home_dirs(genhomedircon_settings_t * s)
return homedir_list;

shells = get_shell_list();
assert(shells);
if (!shells) {
ERR(s->h_semanage, "Allocation failure!");
goto fail;
}

path = semanage_findval(PATH_ETC_LOGIN_DEFS, "UID_MIN", NULL);
if (path && *path) {
Expand Down

0 comments on commit dcd755a

Please sign in to comment.