Skip to content

Commit 20c3315

Browse files
authored
Merge pull request #2036 from 0intro/coverity-uninitialized-variables-20230920
Fix uninitialized variables reported by Coverity
2 parents d29ef10 + 306ab5c commit 20c3315

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/OVAL/oval_component.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,6 +2288,8 @@ static oval_syschar_collection_flag_t _oval_component_evaluate_ARITHMETIC_rec(st
22882288
struct oval_value *ov;
22892289
char sv[32];
22902290

2291+
memset(sv, 0, sizeof (sv));
2292+
22912293
if (datatype == OVAL_DATATYPE_INTEGER) {
22922294
snprintf(sv, sizeof (sv), "%ld", (long int) val);
22932295
} else if (datatype == OVAL_DATATYPE_FLOAT) {

src/OVAL/probes/SEAP/seap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e)
526526
_A(ctx != NULL);
527527
_A(rep_msg != NULL);
528528

529+
err.type = 0;
529530
err.code = e;
530531
err.id = rep_msg->id;
531532
err.data = NULL; /* FIXME: Attach original message */

src/OVAL/probes/probe/icache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ static int probe_cobj_memcheck(size_t item_cnt, double max_ratio)
505505
struct sys_memusage mu_sys;
506506
double c_ratio;
507507

508+
memset(&mu_proc, 0, sizeof(mu_proc));
509+
memset(&mu_sys, 0, sizeof(mu_sys));
510+
508511
if (oscap_proc_memusage (&mu_proc) != 0)
509512
return (-1);
510513

src/OVAL/probes/unix/xinetd_probe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ xiconf_t *xiconf_parse(const char *path, unsigned int max_depth)
746746

747747
switch (inctype) {
748748
case XICONF_INCTYPE_FILE:
749+
strncpy (pathbuf, inclarg, sizeof(pathbuf));
750+
749751
dD("includefile: %s", pathbuf);
750752

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

0 commit comments

Comments
 (0)