Skip to content

Commit

Permalink
fix memory invalid access
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilledheart committed May 13, 2015
1 parent 10e9945 commit 9a6b2bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/network-mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include <QSslCipher>
namespace {
QNetworkProxy proxy_;
template <class T, std::size_t N>
inline size_t ArrayLengthOf(T (&)[N]) {
return N;
}
const char *const kWhitelistCiphers[] = {"ECDHE-RSA-AES256-GCM-SHA384"
"ECDHE-RSA-AES128-GCM-SHA256"
"DHE-RSA-AES256-GCM-SHA384"
Expand Down Expand Up @@ -71,7 +75,7 @@ NetworkManager::NetworkManager() : should_retry_(true) {
Q_FOREACH(const QSslCipher &cipher, ciphers)
{
bool whitelisted = false;
for (unsigned i = 0; i < sizeof(kWhitelistCiphers); ++i) {
for (unsigned i = 0; i < ArrayLengthOf(kWhitelistCiphers); ++i) {
if (cipher.name() == kWhitelistCiphers[i]) {
whitelisted = true;
break;
Expand Down

0 comments on commit 9a6b2bb

Please sign in to comment.