diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-11 11:45:24 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-11 11:49:34 +0900 |
commit | 1c9b5d452e9f2f675130f13393a031e28bf982d7 (patch) | |
tree | bece9835e04d7bfcd59730489854e5f0c9cbb962 /ruby.c | |
parent | 8b585f74604318995daa337d41f19fabb9ce3711 (diff) |
Reject command line option ending with `-`
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1460,7 +1460,8 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) # define is_option_with_arg(name, allow_hyphen, allow_envopt) \ is_option_with_optarg(name, allow_hyphen, allow_envopt, Qtrue, Qtrue) # define is_option_with_optarg(name, allow_hyphen, allow_envopt, needs_arg, next_arg) \ - (strncmp((name), s, n = sizeof(name) - 1) == 0 && is_option_end(s[n], (allow_hyphen)) ? \ + (strncmp((name), s, n = sizeof(name) - 1) == 0 && is_option_end(s[n], (allow_hyphen)) && \ + (s[n] != '-' || s[n+1]) ? \ (check_envopt(name, (allow_envopt)), s += n, \ need_argument(name, s, needs_arg, next_arg), 1) : 0) |