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:04:07 +0100 |
commit | 59eec850679f80dc8c24f866083c6e68b979474e (patch) | |
tree | 561e84f8a0f5d047c0f7139631f47c333083395c | |
parent | 4355cef0e7bcd5fa0c50a7215744bcda934b62ed (diff) | |
download | tqca-59eec850679f80dc8c24f866083c6e68b979474e.tar.gz tqca-59eec850679f80dc8c24f866083c6e68b979474e.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>
(cherry picked from commit fe8afc4649ab348ef297dddd677b5eae4543a1da)
-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; |