summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-21 09:41:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-21 09:41:56 +0000
commitc033efddea5fa5de315df8e560f55106b2b6cded (patch)
treeb2b1d7a454bc0659e7e6feaa995b867a2d944cd7 /ruby.c
parent8fdebec088657cfd6aa08ee588b79740858923e1 (diff)
ruby.c: fix pointer overrun
* ruby.c (proc_options): fix pointer overrun. do not advance argv until it is valid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index 8a93921..ab6d89a 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1088,7 +1088,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
(((allow_envopt) || !envopt) ? (void)0 : \
rb_raise(rb_eRuntimeError, "invalid switch in RUBYOPT: --" name))
# define need_argument(name, s, needs_arg) \
- ((*(s)++ ? !*(s) : (!--argc || !((s) = *++argv))) && (needs_arg) ? \
+ ((*(s) ? !*++(s) : (!argc || !((s) = argv[1]) || (--argc, ++argv, 0))) && (needs_arg) ? \
rb_raise(rb_eRuntimeError, "missing argument for --" name) \
: (void)0)
# define is_option_with_arg(name, allow_hyphen, allow_envopt) \