exec: osmo_system_nowait2: initalize *pw pointer with NULL

The pointer *pw is only populated when the the parameter *user is given,
otherwise it remains uninitalized while it is used later when the
previleges are being dropped.

Change-Id: Idec7041e9ea17a252aefbf6fa90091ae17fd4fcd
Fixes: CID#209895
This commit is contained in:
Philipp Maier 2020-04-20 11:08:29 +02:00 committed by dexter
parent 3edd70c1f1
commit 6a90c723fb
1 changed files with 2 additions and 1 deletions

View File

@ -211,7 +211,8 @@ extern char **environ;
*/
int osmo_system_nowait2(const char *command, const char **env_whitelist, char **addl_env, const char *user)
{
struct passwd _pw, *pw;
struct passwd _pw;
struct passwd *pw = NULL;
int getpw_buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
int rc;