On Wed, Jul 24, 2013 at 8:50 AM, Drew Northup <[email protected]> wrote:
> This time, knowing for sure now that format->buf is not being used in
> the extant code path for any other purpose, I went ahead and
> initialized the whole thing to be sure that we don't find any other
> ghosts hiding in that buffer between uses. Just initializing the
> first byte fixes the near term problem but does not prevent the buffer
> initialization issue that this bug highlighted from rising up again
> later on.
Thanks applied with minor tidyup.
> diff --git a/tig.c b/tig.c
> index ba9ba98..c65bc43 100644
> --- a/tig.c
> +++ b/tig.c
> @@ -3104,8 +3104,12 @@ format_expand_arg(struct format_context *format, const
> char *name)
> static bool
> format_append_arg(struct format_context *format, const char ***dst_argv,
> const char *arg)
> {
> + int i;
Added space after the declaration.
> format->bufpos = 0;
>
> + for (i = 0; i < SIZEOF_STR; i++)
Changed this to use sizeof(format->buf) instead.
> + format->buf[i] = 0;
> +
> while (arg) {
> char *next = strstr(arg, "%(");
> int len = next ? next - arg : strlen(arg);
> --
> 1.8.0
>
--
Jonas Fonseca
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html