Skip to content

eBPF-based security platform

bpm: start every index and state entry from nothing

Daniel Borkmann258105f86694
diff --git a/builtin-bpm.c b/builtin-bpm.c
index 0d7a2789..b77965cf 100644
--- a/builtin-bpm.c
+++ b/builtin-bpm.c
@@ -919,6 +919,8 @@ static int on_state_entry(void *ud)
strcmp(expected, s->scratch.path))
return -EINVAL;
s->items[s->n++] = s->scratch;
+ /* A field the next entry leaves out is not this entry's. */
+ memset(&s->scratch, 0, sizeof(s->scratch));
return 0;
}
diff --git a/util/bpm_package.c b/util/bpm_package.c
index cdc53cc6..483d6378 100644
--- a/util/bpm_package.c
+++ b/util/bpm_package.c
@@ -53,6 +53,9 @@ static int on_index_entry(void *ud)
!s->scratch.package_digest[0] || s->scratch.package_size < 0)
return -EINVAL;
s->items[s->n++] = s->scratch;
+ /* A field the next entry leaves out is not this entry's. */
+ memset(&s->scratch, 0, sizeof(s->scratch));
+ s->scratch.package_size = -1;
return 0;
}