summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/dl/dl.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c8af197958..e94661fc3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 10 14:45:28 2010 KOSAKI Motohiro <[email protected]>
+
+ * 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 <[email protected]>
* configure.in (USE_WINSOCK2): ws2tcpip.h needs listed here.
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 5813adc58b..f11b69c5a5 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -588,7 +588,7 @@ VALUE
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