[前][次][番号順一覧][スレッド一覧]

ruby-changes:40618

From: nobu <ko1@a...>
Date: Sat, 21 Nov 2015 18:42:20 +0900 (JST)
Subject: [ruby-changes:40618] nobu:r52697 (trunk): ruby.c: fix pointer overrun

nobu	2015-11-21 18:41:56 +0900 (Sat, 21 Nov 2015)

  New Revision: 52697

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52697

  Log:
    ruby.c: fix pointer overrun
    
    * ruby.c (proc_options): fix pointer overrun. do not advance argv
      until it is valid.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52696)
+++ ChangeLog	(revision 52697)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Nov 21 18:41:53 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* ext/digest/sha1/extconf.rb: OpenSSL's struct name for SHA1 is
Index: ruby.c
===================================================================
--- ruby.c	(revision 52696)
+++ ruby.c	(revision 52697)
@@ -1088,7 +1088,7 @@ proc_options(long argc, char **argv, str https://github.com/ruby/ruby/blob/trunk/ruby.c#L1088
 	    (((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)	\

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]