Skip to content

Commit

Permalink
src/wmnut.c: avoid strlen(vars) when vars[] may be not initialized
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Aug 12, 2024
1 parent a2f9e06 commit 1b61b9b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wmnut.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ void InitCom(void)
const char *query[4];
char **answer;

memset(vars, 0, sizeof(vars));

/*
* Check NUT daemon availability on host(s)
*/
Expand Down Expand Up @@ -613,6 +615,8 @@ void InitCom(void)
}
}

/* FIXME: With code commented away, we might in fact
* have no vars because we do not fetch any */
if (strlen(vars) == 0) {
DEBUGERR("%s", "No data available check your configuration (ups.conf)\n");
}
Expand Down

0 comments on commit 1b61b9b

Please sign in to comment.