diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-23 08:58:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-23 08:58:53 +0000 |
commit | 802d4f9fb2a8a5f2be1eb6be13dc4f286ad221af (patch) | |
tree | ccb829052098690efa5ccf6fa5fefaaf7bc77fd8 /ext/win32 | |
parent | ba3da9af7d8db43d421426d506d3f0ab1a0f757e (diff) | |
download | bundler-802d4f9fb2a8a5f2be1eb6be13dc4f286ad221af.tar.gz |
registry.rb: fix buffer overflow
* ext/win32/lib/win32/registry.rb (Win32::Registry::Error#initialize):
should not re-use sliced string as buffer, to get rid of buffer
overflow. [ruby-core:65295] [Bug #10300]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32')
-rw-r--r-- | ext/win32/lib/win32/registry.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb index 8dcf139480..c739dc97a2 100644 --- a/ext/win32/lib/win32/registry.rb +++ b/ext/win32/lib/win32/registry.rb @@ -174,11 +174,11 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr FormatMessageW = Kernel32.extern "int FormatMessageW(int, void *, int, int, void *, int, void *)", :stdcall def initialize(code) @code = code - msg = WCHAR_NUL * 1024 + buff = WCHAR_NUL * 1024 lang = 0 begin - len = FormatMessageW.call(0x1200, 0, code, lang, msg, 1024, 0) - msg = msg.byteslice(0, len * WCHAR_SIZE) + len = FormatMessageW.call(0x1200, 0, code, lang, buff, 1024, 0) + msg = buff.byteslice(0, len * WCHAR_SIZE) msg.delete!(WCHAR_CR) msg.chomp! msg.encode!(LOCALE) |