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

ruby-changes:43188

From: nobu <ko1@a...>
Date: Thu, 2 Jun 2016 21:21:46 +0900 (JST)
Subject: [ruby-changes:43188] nobu:r55262 (trunk): etc.c: retry with allocated string buffer

nobu	2016-06-02 21:21:42 +0900 (Thu, 02 Jun 2016)

  New Revision: 55262

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

  Log:
    etc.c: retry with allocated string buffer
    
    * ext/etc/etc.c (etc_systmpdir): retry with allocated string
      buffer if static buffer size is not enough.

  Modified files:
    trunk/ext/etc/etc.c
Index: ext/etc/etc.c
===================================================================
--- ext/etc/etc.c	(revision 55261)
+++ ext/etc/etc.c	(revision 55262)
@@ -664,9 +664,15 @@ etc_systmpdir(void) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L664
     if (len > 0) {
 	tmpstr = path;
 	tmplen = len - 1;
+	if (len > sizeof(path)) tmpstr = 0;
     }
 # endif
     tmpdir = rb_filesystem_str_new(tmpstr, tmplen);
+# if defined _CS_DARWIN_USER_TEMP_DIR
+    if (!tmpstr) {
+	confstr(_CS_DARWIN_USER_TEMP_DIR, RSTRING_PTR(tmpdir), len);
+    }
+# endif
 #endif
     FL_UNSET(tmpdir, FL_TAINT);
     return tmpdir;

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

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