]> git.ipfire.org Git - thirdparty/git.git/commitdiff
history: initialize rev_info in cmd_history_reword()
authorRené Scharfe <l.s.r@web.de>
Sun, 8 Mar 2026 09:57:02 +0000 (10:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Mar 2026 19:34:52 +0000 (12:34 -0700)
git history reword expects a single valid revision argument and errors
out if it doesn't get it.  In that case the struct rev_info passed to
release_revisions() for cleanup is still uninitialized, which can result
in attempts to free(3) random pointers.  Avoid that by initializing the
structure.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/history.c

index 1cf6c668cfd81465961f49de14ce9050717591e9..88822a184fa5bcaffab34cbbb31c0813e866c44b 100644 (file)
@@ -425,7 +425,7 @@ static int cmd_history_reword(int argc,
        };
        struct strbuf reflog_msg = STRBUF_INIT;
        struct commit *original, *rewritten;
-       struct rev_info revs;
+       struct rev_info revs = { 0 };
        int ret;
 
        argc = parse_options(argc, argv, prefix, options, usage, 0);