Skip to content

Commit

Permalink
Fix uninitialized variables reported by Coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
0intro committed Sep 20, 2023
1 parent 73d957d commit 306ab5c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
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

0 comments on commit 306ab5c

Please sign in to comment.