aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorKristoffer Haugsbakk <code@khaugsbakk.name>2024-02-13 17:01:20 +0100
committerJunio C Hamano <gitster@pobox.com>2024-02-13 10:18:50 -0800
commitf2d31c69ce38e4515d5dfac34c69423c833b85f9 (patch)
tree5a941b48743d03b6a1a52bbe24f592d242fbea47 /builtin
parent7adf215fede93114f8ee376c82adb5b8dd0f73c7 (diff)
downloadgit-f2d31c69ce38e4515d5dfac34c69423c833b85f9.tar.gz
column: disallow negative padding
A negative padding does not make sense and can cause errors in the memory allocator since it’s interpreted as an unsigned integer. Reported-by: Tiago Pascoal <tiago@pascoal.net> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/column.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/column.c b/builtin/column.c
index e80218f81f..10ff7e0166 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -45,6 +45,8 @@ int cmd_column(int argc, const char **argv, const char *prefix)
memset(&copts, 0, sizeof(copts));
copts.padding = 1;
argc = parse_options(argc, argv, prefix, options, builtin_column_usage, 0);
+ if (copts.padding < 0)
+ die(_("%s must be non-negative"), "--padding");
if (argc)
usage_with_options(builtin_column_usage, options);
if (real_command || command) {