Thread (17 messages) flat view 17 messages, 2 authors, 18h ago

Re: [PATCH 4/4] format-rev: learn --abbrev, --color, and --date

From: Junio C Hamano <hidden>
Date: 2026-08-17 16:55:03

"Kristoffer Haugsbakk" [off-list ref] writes:
    static int format_nul_cb(const struct option *option,
                             const char *arg,
                             int unset)
    {
            struct format_rev_data *data = option->value;
            data->nul_input = 1;
            data->nul_output = 1;
            BUG_ON_OPT_NEG(unset);
            BUG_ON_OPT_ARG(arg);
            return 0;
    }

But this does not have the `NULL` deref. problem since we just
unconditionally set two boolean values. Still, for readability it’s
better for these two statements to go at the start. Since they are
preconditions. I will add this as a patch/commit to the series.
Yeah, it would be a good idea to establish the "validate before
doing anything with the parameters" pattern.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help