Message ID | 20241023134318.733305-3-vmojzis@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 00fb52ce3477 |
Headers | show |
Series | [v2,1/4] libsepol/cil: Initialize avtab_datum on declaration | expand |
diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c index ac99997f..d63a5496 100644 --- a/libsepol/cil/src/cil_post.c +++ b/libsepol/cil/src/cil_post.c @@ -1315,6 +1315,8 @@ static int __cil_expr_to_bitmap(struct cil_list *expr, ebitmap_t *out, int max, curr = expr->head; flavor = expr->flavor; + ebitmap_init(&tmp); + if (curr->flavor == CIL_OP) { enum cil_flavor op = (enum cil_flavor)(uintptr_t)curr->data;
tmp.node was not always initialized before being used by ebitmap_destroy. Fixes: Error: UNINIT (CWE-457): libsepol-3.7/cil/src/cil_post.c:1309:2: var_decl: Declaring variable "tmp" without initializer. libsepol-3.7/cil/src/cil_post.c:1382:6: uninit_use_in_call: Using uninitialized value "tmp.node" when calling "ebitmap_destroy". \# 1380| if (rc != SEPOL_OK) { \# 1381| cil_log(CIL_INFO, "Failed to apply operator to bitmaps\n"); \# 1382|-> ebitmap_destroy(&tmp); \# 1383| goto exit; \# 1384| } Signed-off-by: Vit Mojzis <vmojzis@redhat.com> --- libsepol/cil/src/cil_post.c | 2 ++ 1 file changed, 2 insertions(+)