Skip to content

Commit fbc3cb2

Browse files
committed
WiFiSSLCllient: add error checking
1 parent ad3de4b commit fbc3cb2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

arduino/libraries/WiFi/src/WiFiSSLClient.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,24 @@ int WiFiSSLClient::connect(const char* host, uint16_t port, bool sni)
8080
const unsigned char* certs_data = {};
8181

8282
const esp_partition_t* part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "certs");
83-
if (part == NULL)
84-
{
83+
if (part == NULL) {
8584
return 0;
8685
}
8786

8887
int ret = esp_partition_mmap(part, 0, part->size, SPI_FLASH_MMAP_DATA, (const void**)&certs_data, &handle);
89-
if (ret != ESP_OK)
90-
{
88+
if (ret != ESP_OK) {
9189
return 0;
9290
}
9391

94-
esp_crt_bundle_attach(&_sslConfig);
95-
esp_crt_bundle_set(certs_data, CRT_BUNDLE_SIZE);
92+
ret = esp_crt_bundle_attach(&_sslConfig);
93+
if (ret != ESP_OK) {
94+
return 0;
95+
}
96+
97+
ret = esp_crt_bundle_set(certs_data, CRT_BUNDLE_SIZE);
98+
if (ret != ESP_OK) {
99+
return 0;
100+
}
96101

97102
mbedtls_ssl_conf_rng(&_sslConfig, mbedtls_ctr_drbg_random, &_ctrDrbgContext);
98103

0 commit comments

Comments
 (0)