From 1bc72206cbd85d5c9501ff5a0aba6ff2606c8941 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 13 Dec 2015 09:19:20 +0000 Subject: win32ole.c: check argument type * ext/win32ole/win32ole.c (ole_vstr2wc): check argument type, vstr must be a String here. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/win32ole/win32ole.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ext/win32ole') diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 14147ab7bc..02ad82b4d4 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -860,6 +860,11 @@ ole_vstr2wc(VALUE vstr) LPWSTR pw; st_data_t data; struct st_table *tbl = DATA_PTR(enc2cp_hash); + + /* do not type-conversion here to prevent from other arguments + * changing (if exist) */ + Check_Type(vstr, T_STRING); + enc = rb_enc_get(vstr); if (st_lookup(tbl, (VALUE)enc | FIXNUM_FLAG, &data)) { -- cgit v1.2.3