diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-21 09:41:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-21 09:41:56 +0000 |
commit | c033efddea5fa5de315df8e560f55106b2b6cded (patch) | |
tree | b2b1d7a454bc0659e7e6feaa995b867a2d944cd7 | |
parent | 8fdebec088657cfd6aa08ee588b79740858923e1 (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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ruby.c | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Sat Nov 21 18:41:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ruby.c (proc_options): fix pointer overrun. do not advance argv + until it is valid. + Sat Nov 21 13:59:09 2015 NARUSE, Yui <naruse@ruby-lang.org> * ext/digest/sha1/extconf.rb: OpenSSL's struct name for SHA1 is @@ -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) \ |