From 174f35b64239da30f64f3620416243e344b17572 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 3 Oct 2024 16:30:54 +0300 Subject: [PATCH] events: do not read garbage memory on empty control files --- pkg/noun/events.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 661e07d20f..49e79ce0a6 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -456,6 +456,10 @@ _ce_patch_read_control(u3_ce_patch* pat_u) len_w = (c3_w) buf_u.st_size; } + if (0 == len_w) { + return c3n; + } + pat_u->con_u = c3_malloc(len_w); if ( (len_w != read(pat_u->ctl_i, pat_u->con_u, len_w)) || (len_w != sizeof(u3e_control) +