Skip to content

Commit

Permalink
Merge pull request #1704 from phire/wii_ssl_segfault
Browse files Browse the repository at this point in the history
De-memsetify Wii_SSL and fix segfault.
  • Loading branch information
Parlane committed Dec 20, 2014
2 parents 793862a + 950ca26 commit 6a785af
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CWII_IPC_HLE_Device_net_ssl::CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const st
{
for (WII_SSL& ssl : _SSL)
{
memset(&ssl, 0, sizeof(WII_SSL));
ssl.active = false;
}
}

Expand All @@ -33,9 +33,6 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
x509_crt_free(&ssl.cacert);
x509_crt_free(&ssl.clicert);

memset(&ssl.ctx, 0, sizeof(ssl_context));
memset(&ssl.session, 0, sizeof(ssl_session));
memset(&ssl.entropy, 0, sizeof(entropy_context));
ssl.hostname.clear();

ssl.active = false;
Expand Down Expand Up @@ -145,8 +142,6 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
int ret = ssl_init(&ssl->ctx);
if (ret)
{
// Cleanup possibly dirty ctx
memset(&ssl->ctx, 0, sizeof(ssl_context));
goto _SSL_NEW_ERROR;
}

Expand All @@ -159,8 +154,6 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
if (ret)
{
ssl_free(&ssl->ctx);
// Cleanup possibly dirty ctx
memset(&ssl->ctx, 0, sizeof(ssl_context));
entropy_free(&ssl->entropy);
goto _SSL_NEW_ERROR;
}
Expand Down Expand Up @@ -213,9 +206,6 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
x509_crt_free(&ssl->cacert);
x509_crt_free(&ssl->clicert);

memset(&ssl->ctx, 0, sizeof(ssl_context));
memset(&ssl->session, 0, sizeof(ssl_session));
memset(&ssl->entropy, 0, sizeof(entropy_context));
ssl->hostname.clear();

ssl->active = false;
Expand Down Expand Up @@ -294,8 +284,6 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
{
x509_crt_free(&ssl->clicert);
pk_free(&ssl->pk);
memset(&ssl->clicert, 0, sizeof(x509_crt));
memset(&ssl->pk, 0, sizeof(pk_context));
Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
}
else
Expand Down Expand Up @@ -329,8 +317,6 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
WII_SSL* ssl = &_SSL[sslID];
x509_crt_free(&ssl->clicert);
pk_free(&ssl->pk);
memset(&ssl->clicert, 0, sizeof(x509_crt));
memset(&ssl->pk, 0, sizeof(pk_context));

ssl_set_own_cert(&ssl->ctx, nullptr, nullptr);
Memory::Write_U32(SSL_OK, _BufferIn);
Expand Down

0 comments on commit 6a785af

Please sign in to comment.