jonas/tig — pull request #291 by vivien (2014-05-14 20:08:32+00:00)
Title: argv: ensure closing parenthesis in variables

While format_expand_arg() can assume a variable is well formed,
format_append_arg() should not.

A command using '%(prompt' without closing parenthesis causes Tig to
segfault. This is due to format_append_arg() which assumes the presence
of a ')' char, resulting in the 'next' variable being 0x1 (NULL + 1).

This patch checks for this case and return FALSE in consequence.

In the meantime, constify variables in these two functions.

Signed-off-by: Vivien Didelot