Skip to content

Commit

Permalink
fix(ssl): Cast the buffers to non-const
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Jun 3, 2024
1 parent 67c0e93 commit 1d2878f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libraries/NetworkClientSecure/src/NetworkClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ NetworkClientSecure::NetworkClientSecure(int sock) {

NetworkClientSecure::~NetworkClientSecure() {
if (_ca_cert_free && _CA_cert) {
free(_CA_cert);
free((void *)_CA_cert);
}
if (_cert_free && _cert) {
free(_cert);
free((void *)_cert);
}
if (_private_key_free && _private_key) {
free(_private_key);
free((void *)_private_key);
}
}

Expand Down Expand Up @@ -330,7 +330,7 @@ void NetworkClientSecure::setInsecure() {

void NetworkClientSecure::setCACert(const char *rootCA) {
if (_ca_cert_free && _CA_cert) {
free(_CA_cert);
free((void *)_CA_cert);
_ca_cert_free = false;
}
_CA_cert = rootCA;
Expand All @@ -349,15 +349,15 @@ void NetworkClientSecure::setCACertBundle(const uint8_t *bundle) {

void NetworkClientSecure::setCertificate(const char *client_ca) {
if (_cert_free && _cert) {
free(_cert);
free((void *)_cert);
_cert_free = false;
}
_cert = client_ca;
}

void NetworkClientSecure::setPrivateKey(const char *private_key) {
if (_private_key_free && _private_key) {
free(_private_key);
free((void *)_private_key);
_private_key_free = false;
}
_private_key = private_key;
Expand Down

0 comments on commit 1d2878f

Please sign in to comment.