From 03fcc1b5fce42cb32b8675ffd052668f71dea0f6 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 1 Feb 2012 23:26:25 +0100 Subject: [PATCH] LVSL/RemoteVstPlugin: use big enough buffer when gathering preset names The RemoteVstPlugin process crashed for plugins with lots of presets as there was an overflow of the presName buffer. Chosing a bigger buffer size fixes the problem. Additionally initialize len variable in loadChunkFromPresetFile(). --- plugins/vst_base/RemoteVstPlugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 2f17643d9..63f441c0b 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -894,7 +894,7 @@ void RemoteVstPlugin::rotateProgram( int _len ) void RemoteVstPlugin::loadPrograms( int _len ) { - char presName[4096]; + char presName[1024+256*30]; char curProgName[30]; if (isInitialized() == false) return; bool progNameIndexed = (m_plugin->dispatcher(m_plugin, 29, 0, -1, curProgName, 0) == 1); @@ -1038,7 +1038,7 @@ void RemoteVstPlugin::loadChunkFromPresetFile( const std::string & _file ) { void * chunk = NULL; unsigned int * pLen = new unsigned int[ 1 ]; - unsigned int len; + unsigned int len = 0; sBank * pBank = (sBank*) new char[ sizeof( sBank ) ]; FILE * stream = fopen( _file.c_str(), "r" ); fread ( pBank, 1, 56, stream );