mirror of
https://github.com/git/git
synced 2024-09-29 21:27:13 +00:00
column: guard against negative padding
Make sure that client code can’t pass in a negative padding by accident. Suggested-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f2d31c69ce
commit
76fb807faa
4
column.c
4
column.c
|
@ -182,6 +182,8 @@ void print_columns(const struct string_list *list, unsigned int colopts,
|
||||||
{
|
{
|
||||||
struct column_options nopts;
|
struct column_options nopts;
|
||||||
|
|
||||||
|
if (opts && (0 > opts->padding))
|
||||||
|
BUG("padding must be non-negative");
|
||||||
if (!list->nr)
|
if (!list->nr)
|
||||||
return;
|
return;
|
||||||
assert((colopts & COL_ENABLE_MASK) != COL_AUTO);
|
assert((colopts & COL_ENABLE_MASK) != COL_AUTO);
|
||||||
|
@ -361,6 +363,8 @@ int run_column_filter(int colopts, const struct column_options *opts)
|
||||||
{
|
{
|
||||||
struct strvec *argv;
|
struct strvec *argv;
|
||||||
|
|
||||||
|
if (opts && (0 > opts->padding))
|
||||||
|
BUG("padding must be non-negative");
|
||||||
if (fd_out != -1)
|
if (fd_out != -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue