From: Adrian Ratiu Date: Wed, 25 Mar 2026 19:54:53 GMT Subject: [PATCH v3 02/12] builtin/receive-pack: properly init receive_hook strbuf Message-ID: <20260325195503.1139418-3-adrian.ratiu@collabora.com> In-Reply-To: <20260325195503.1139418-1-adrian.ratiu@collabora.com> The run_receive_hook() stack-allocated `struct receive_hook_feed_state` is a template with initial values for child states allocated on the heap for each hook process, by calling receive_hook_feed_state_alloc() when spinning up each hook child. All these values are already initialized to zero, however I forgot to properly initialize the strbuf, which I left NULL. This is more of a code cleanup because in practice it has no effect, the states used by the children are always initialized, however it's good to fix in case someone ends up accidentally dereferencing the NULL pointer in the future. Reported-by: Patrick Steinhardt Signed-off-by: Adrian Ratiu --- builtin/receive-pack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index e34edff406..a1ffe4570f 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -963,6 +963,7 @@ static int run_receive_hook(struct command *commands, /* set up stdin callback */ feed_init_state.cmd = commands; feed_init_state.skip_broken = skip_broken; + strbuf_init(&feed_init_state.buf, 0); opt.feed_pipe_ctx = &feed_init_state; opt.feed_pipe = feed_receive_hook_cb; opt.feed_pipe_cb_data_alloc = receive_hook_feed_state_alloc; -- 2.52.0.732.gb351b5166d.dirty