diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2015-03-17 17:00:15 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-19 11:03:01 -0700 |
commit | 546cb854931ed7b8d72dbb204e1abe36cc366bdd (patch) | |
tree | 966d8d7a3a7370c35f4e4b9b93c106ae6459b317 | |
parent | 80c01a5b9d32223d4fc6d0abfe0e4e405dcdbe21 (diff) | |
download | git-546cb854931ed7b8d72dbb204e1abe36cc366bdd.tar.gz |
diff_opt_parse(): use convert_i() when handling "-l<num>"
die() with an error message if the argument is not a non-negative
integer. This change tightens up parsing: '+' and '-', leading
whitespace, and trailing junk are all disallowed now.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | diff.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -3798,7 +3798,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) else if (!strcmp(arg, "-z")) options->line_termination = 0; else if ((argcount = short_opt('l', av, &optarg))) { - options->rename_limit = strtoul(optarg, NULL, 10); + if (convert_i(optarg, 10, &options->rename_limit)) + die("-l requires a non-negative integer argument"); return argcount; } else if ((argcount = short_opt('S', av, &optarg))) { |