Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid memory read on opening the ZynAddSubFx GUI #5299

Merged
merged 1 commit into from
Nov 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/RemotePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@ RemotePlugin::RemotePlugin() :

m_socketFile = QDir::tempPath() + QDir::separator() +
QUuid::createUuid().toString();
const char * path = m_socketFile.toUtf8().constData();
size_t length = strlen( path );
auto path = m_socketFile.toUtf8();
size_t length = path.length();
if ( length >= sizeof sa.sun_path )
{
length = sizeof sa.sun_path - 1;
qWarning( "Socket path too long." );
}
memcpy( sa.sun_path, path, length );
memcpy(sa.sun_path, path.constData(), length );
sa.sun_path[length] = '\0';

m_server = socket( PF_LOCAL, SOCK_STREAM, 0 );
if ( m_server == -1 )
{
qWarning( "Unable to start the server." );
}
remove( path );
remove(path.constData());
int ret = bind( m_server, (struct sockaddr *) &sa, sizeof sa );
if ( ret == -1 || listen( m_server, 1 ) == -1 )
{
Expand Down