Skip to content

Commit f806df9

Browse files
committed
fixup! hooks: add custom post-command hook config
The handle_hook_replacement() call in list_hooks_add_default() was added to interject VFS hook behavior. It dereferences `options->args`, but `options` can be NULL when called via hook_exists() which passes NULL for the options parameter through list_hooks(). This causes a UBSAN runtime error (null pointer member access) and SIGABRT on every code path that calls hook_exists(), which includes rebase, checkout, commit, and many other commands. Guard the dereference with an `options` NULL check. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 4c0383b commit f806df9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

hook.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ static void list_hooks_add_default(struct repository *r, const char *hookname,
245245
struct hook *h;
246246

247247
/* Interject hook behavior depending on strategy. */
248-
if (r && handle_hook_replacement(r, hookname, &options->args))
248+
if (r && options &&
249+
handle_hook_replacement(r, hookname, &options->args))
249250
return;
250251

251252
hook_path = find_hook(r, hookname);

0 commit comments

Comments
 (0)