summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2014-12-15 18:17:00 +1300
committerScott Mansell <phiren@gmail.com>2014-12-15 18:17:00 +1300
commit950ca267bb965f3d01ad3657609f8dcbc55a45a6 (patch)
tree2b7cb18d5542d5468bec48291cdac1b6b60418e6 /Source/Core
parentc7179af8f73bdad27bfa09b97081f48de941eb99 (diff)
De-memsetify Wii_SSL and fix segfault.
Fixes #7917 The first memset was clearing the delicate bits of the std::string in the struct, causing segfaults. I also removed the rest of the memsets because they were paranoid, unneeded and waseful. We shouldn't be managing the ssl libraries structs for it. I checked and the ssl library's functions were already memsetting those structs as needed.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
index e6f5594a09..8641beba60 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
@@ -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;
}
}
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -213,9 +206,6 @@ _SSL_NEW_ERROR:
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;
@@ -294,8 +284,6 @@ _SSL_NEW_ERROR:
{
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
@@ -329,8 +317,6 @@ _SSL_NEW_ERROR:
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);