diff options
| author | Adrian Ratiu <adrian.ratiu@collabora.com> | 2026-03-25 21:54:53 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-25 14:00:45 -0700 |
| commit | 6b9f9e2d2f3d9d6634e72d190e800f65f9a88f30 (patch) | |
| tree | 443468ec11b0971838980c71252356f2de61ecbd /builtin/receive-pack.c | |
| parent | add3564d2f2804ad37b9af773ec6420b497a1725 (diff) | |
| download | git-6b9f9e2d2f3d9d6634e72d190e800f65f9a88f30.tar.xz | |
builtin/receive-pack: properly init receive_hook strbuf
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 <ps@pks.im>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
| -rw-r--r-- | builtin/receive-pack.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 415bb57362..63b2f7d543 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; |
