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

ruby-changes:16282

From: knu <ko1@a...>
Date: Thu, 10 Jun 2010 15:05:45 +0900 (JST)
Subject: [ruby-changes:16282] Ruby:r28250 (ruby_1_8): * ext/dl/dl.c (rb_dl_strdup): strdup() only allocates a buffer of

knu	2010-06-10 14:51:12 +0900 (Thu, 10 Jun 2010)

  New Revision: 28250

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

  Log:
    * ext/dl/dl.c (rb_dl_strdup): strdup() only allocates a buffer of
      strlen()+1 bytes. [Bug #2794]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/ext/dl/dl.c

Index: ruby_1_8/ext/dl/dl.c
===================================================================
--- ruby_1_8/ext/dl/dl.c	(revision 28249)
+++ ruby_1_8/ext/dl/dl.c	(revision 28250)
@@ -588,7 +588,7 @@
 rb_dl_strdup(VALUE self, VALUE str)
 {
   SafeStringValue(str);
-  return rb_dlptr_new(strdup(RSTRING(str)->ptr), RSTRING(str)->len, dlfree);
+  return rb_dlptr_new(strdup(RSTRING(str)->ptr), strlen(RSTRING(str)->ptr)+1, dlfree);
 }
 
 static VALUE
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 28249)
+++ ruby_1_8/ChangeLog	(revision 28250)
@@ -1,3 +1,8 @@
+Thu Jun 10 14:45:28 2010  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* ext/dl/dl.c (rb_dl_strdup): strdup() only allocates a buffer of
+	  strlen()+1 bytes. [Bug #2794]
+
 Tue Jun  8 18:32:47 2010  URABE Shyouhei  <shyouhei@r...>
 
 	* configure.in (USE_WINSOCK2): ws2tcpip.h needs listed here.

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

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