summaryrefslogtreecommitdiff
path: root/lib/gnutlsxx.cpp
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2021-02-16 07:51:10 +0100
committerDaiki Ueno <ueno@gnu.org>2021-02-16 07:51:10 +0100
commit01ef02f4ec8183484a45defe5c7a64e36c688943 (patch)
treebaf3330db102a990a93f0ae45b553fa18af1c785 /lib/gnutlsxx.cpp
parent75866dd7bb11be3ec80873455832abb087527dac (diff)
downloadgnutls-01ef02f4ec8183484a45defe5c7a64e36c688943.tar.gz
gnutlsxx: dh_params, rsa_params: actually assign values in operator=
The previous implementation assigned the value to a temporary variable and then return it without assigning it to 'this'. That is not only contradictory to user's expectation but also cppcheck treats it as a logic error. Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/gnutlsxx.cpp')
-rw-r--r--lib/gnutlsxx.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gnutlsxx.cpp b/lib/gnutlsxx.cpp
index ea1632174b..3613502aba 100644
--- a/lib/gnutlsxx.cpp
+++ b/lib/gnutlsxx.cpp
@@ -950,7 +950,10 @@ psk_server_credentials::psk_server_credentials ():credentials
throw (exception (ret));
}
- return *dst;
+ std::swap (this->params, dst->params);
+ delete dst;
+
+ return *this;
}
// RSA
@@ -1003,7 +1006,10 @@ psk_server_credentials::psk_server_credentials ():credentials
throw (exception (ret));
}
- return *dst;
+ std::swap (this->params, dst->params);
+ delete dst;
+
+ return *this;
}
void rsa_params::import_raw (const gnutls_datum_t & m,