Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninitialized variables reported by Coverity #2036

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/OVAL/oval_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,8 @@ static oval_syschar_collection_flag_t _oval_component_evaluate_ARITHMETIC_rec(st
struct oval_value *ov;
char sv[32];

memset(sv, 0, sizeof (sv));

if (datatype == OVAL_DATATYPE_INTEGER) {
snprintf(sv, sizeof (sv), "%ld", (long int) val);
} else if (datatype == OVAL_DATATYPE_FLOAT) {
Expand Down
1 change: 1 addition & 0 deletions src/OVAL/probes/SEAP/seap.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e)
_A(ctx != NULL);
_A(rep_msg != NULL);

err.type = 0;
err.code = e;
err.id = rep_msg->id;
err.data = NULL; /* FIXME: Attach original message */
Expand Down
3 changes: 3 additions & 0 deletions src/OVAL/probes/probe/icache.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ static int probe_cobj_memcheck(size_t item_cnt, double max_ratio)
struct sys_memusage mu_sys;
double c_ratio;

memset(&mu_proc, 0, sizeof(mu_proc));
memset(&mu_sys, 0, sizeof(mu_sys));

if (oscap_proc_memusage (&mu_proc) != 0)
return (-1);

Expand Down
2 changes: 2 additions & 0 deletions src/OVAL/probes/unix/xinetd_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ xiconf_t *xiconf_parse(const char *path, unsigned int max_depth)

switch (inctype) {
case XICONF_INCTYPE_FILE:
strncpy (pathbuf, inclarg, sizeof(pathbuf));

dD("includefile: %s", pathbuf);

if (xiconf_add_cfile (xiconf, pathbuf, xifile->depth + 1) != 0) {
Expand Down