Skip to content

eBPF-based security platform

bpm: refuse a tree eventlog that holds a NUL

Daniel Borkmann83530a9f21fa
diff --git a/util/bpm_tree_state.c b/util/bpm_tree_state.c
index 0318a937..10f8e304 100644
--- a/util/bpm_tree_state.c
+++ b/util/bpm_tree_state.c
@@ -627,6 +627,11 @@ int tree_event_replay(__u8 out[32])
if (rc)
return rc;
+ /* A NUL would end the walk early and replay a shorter chain. */
+ if (memchr(body, '\0', len)) {
+ xfree(body, len + 1);
+ return -EINVAL;
+ }
for (line = strtok_r((char *)body, "\n", &save); line;
line = strtok_r(NULL, "\n", &save)) {
char digest[128] = {};