summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 05:10:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 05:10:41 +0000
commitcd171e481ffaf1a5ebfe9b3e1c13ec12afbb6216 (patch)
treec04d273c43616cbf4c6b3b296b2eeb95d6f6022c /ext
parent2e86a92b3c9153bc5bc47e5684ab3ace70d824ae (diff)
merge revision(s) 47153: [Backport #10127]
* ext/win32ole/win32ole.c (ole_create_dcom): use the converted result if the argument can be converted to a string, to get rid of invalid access. Thanks to nobu. [ruby-dev:48467] [Bug #10127] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/win32ole/win32ole.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index b48a8a7291..3174815aef 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -361,7 +361,7 @@ static VALUE typelib_file_from_typelib(VALUE ole);
static VALUE typelib_file(VALUE ole);
static void ole_const_load(ITypeLib *pTypeLib, VALUE klass, VALUE self);
static HRESULT clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid);
-static VALUE ole_create_dcom(int argc, VALUE *argv, VALUE self);
+static VALUE ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others);
static VALUE ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self);
static VALUE fole_s_connect(int argc, VALUE *argv, VALUE self);
static VALUE fole_s_const_load(int argc, VALUE *argv, VALUE self);
@@ -2612,9 +2612,8 @@ clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid)
}
static VALUE
-ole_create_dcom(int argc, VALUE *argv, VALUE self)
+ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others)
{
- VALUE ole, host, others;
HRESULT hr;
CLSID clsid;
OLECHAR *pbuf;
@@ -2632,7 +2631,6 @@ ole_create_dcom(int argc, VALUE *argv, VALUE self)
GetProcAddress(gole32, "CoCreateInstanceEx");
if (!gCoCreateInstanceEx)
rb_raise(rb_eRuntimeError, "CoCreateInstanceEx is not supported in this environment");
- rb_scan_args(argc, argv, "2*", &ole, &host, &others);
pbuf = ole_vstr2wc(ole);
hr = CLSIDFromProgID(pbuf, &clsid);
@@ -3250,7 +3248,7 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
rb_raise(rb_eSecurityError, "Insecure Object Creation - %s",
StringValuePtr(svr_name));
}
- return ole_create_dcom(argc, argv, self);
+ return ole_create_dcom(self, svr_name, host, others);
}
/* get CLSID from OLE server name */