diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2020-01-10 03:02:41 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2020-01-10 03:03:16 +0100 |
commit | fe8afc4649ab348ef297dddd677b5eae4543a1da (patch) | |
tree | 71767b3b6adf856d0b5815e33de66d9617d409bf /src | |
parent | 2eade3294c42f72c9b96a81764be4a584b31cabf (diff) | |
download | tqca-fe8afc4649ab348ef297dddd677b5eae4543a1da.tar.gz tqca-fe8afc4649ab348ef297dddd677b5eae4543a1da.zip |
Add safety check for from.d->c in Cert::operator=.
Taken from a copy of TQCA in tdenetwork/kopete/groupwise.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src')
-rw-r--r-- | src/tqca.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tqca.cpp b/src/tqca.cpp index 3ff9a58..8eb7bb5 100644 --- a/src/tqca.cpp +++ b/src/tqca.cpp @@ -696,6 +696,7 @@ public: Cert::Cert() { d = new Private; + // crash because this is returning 0 d->c = (TQCA_CertContext *)getContext(CAP_X509); } @@ -708,7 +709,10 @@ Cert::Cert(const Cert &from) Cert & Cert::operator=(const Cert &from) { delete d->c; - d->c = from.d->c->clone(); + if ( from.d->c ) + d->c = from.d->c->clone(); + else + d->c = 0; return *this; } @@ -837,6 +841,7 @@ public: to_net.resize(0); host = ""; hostMismatch = false; + // this causes the crash, because the Cert ctor is setting a null context cert = Cert(); bytesEncoded = 0; tryMore = false; |