diff options
author | Kristoffer Haugsbakk <code@khaugsbakk.name> | 2024-02-13 17:01:21 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-13 10:18:57 -0800 |
commit | 76fb807faacc38661ddb1c561ed80930699146ec (patch) | |
tree | a42a1ede9c9707aebb240b09f02e7cc7badf10e4 /column.c | |
parent | f2d31c69ce38e4515d5dfac34c69423c833b85f9 (diff) | |
download | git-76fb807faacc38661ddb1c561ed80930699146ec.tar.gz |
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>
Diffstat (limited to 'column.c')
-rw-r--r-- | column.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -182,6 +182,8 @@ void print_columns(const struct string_list *list, unsigned int colopts, { struct column_options nopts; + if (opts && (0 > opts->padding)) + BUG("padding must be non-negative"); if (!list->nr) return; 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; + if (opts && (0 > opts->padding)) + BUG("padding must be non-negative"); if (fd_out != -1) return -1; |