From f350d1661134a12a34eb4115d8f2118b9680e514 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Thu, 1 Aug 2024 13:29:44 +0300 Subject: [PATCH] fix(ssl): Add size arg to NetworkClientSecure::setCACertBundle --- libraries/NetworkClientSecure/src/NetworkClientSecure.cpp | 6 +++--- libraries/NetworkClientSecure/src/NetworkClientSecure.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp b/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp index 73ff6da5dcc..87917e58b8f 100644 --- a/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp +++ b/libraries/NetworkClientSecure/src/NetworkClientSecure.cpp @@ -339,9 +339,9 @@ void NetworkClientSecure::setCACert(const char *rootCA) { _use_insecure = false; } -void NetworkClientSecure::setCACertBundle(const uint8_t *bundle) { - if (bundle != NULL) { - esp_crt_bundle_set(bundle, sizeof(bundle)); +void NetworkClientSecure::setCACertBundle(const uint8_t *bundle, size_t size) { + if (bundle != NULL && size > 0) { + esp_crt_bundle_set(bundle, size); attach_ssl_certificate_bundle(sslclient.get(), true); _use_ca_bundle = true; } else { diff --git a/libraries/NetworkClientSecure/src/NetworkClientSecure.h b/libraries/NetworkClientSecure/src/NetworkClientSecure.h index 147acbe37fd..46f725d5633 100644 --- a/libraries/NetworkClientSecure/src/NetworkClientSecure.h +++ b/libraries/NetworkClientSecure/src/NetworkClientSecure.h @@ -73,7 +73,7 @@ class NetworkClientSecure : public NetworkClient { void setCertificate(const char *client_ca); void setPrivateKey(const char *private_key); bool loadCACert(Stream &stream, size_t size); - void setCACertBundle(const uint8_t *bundle); + void setCACertBundle(const uint8_t *bundle, size_t size); bool loadCertificate(Stream &stream, size_t size); bool loadPrivateKey(Stream &stream, size_t size); bool verify(const char *fingerprint, const char *domain_name);