Skip to content

Commit 6575284

Browse files
rtrbtMattiasTF
authored andcommitted
STA: Fix WPA enterprise cert/key lengths.
The eap_client wants lengths including the null terminator.
1 parent 70877df commit 6575284

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/WiFi/src/STA.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,17 +482,17 @@ bool STAClass::connect(
482482

483483
if (ca_pem) {
484484
#if __has_include("esp_eap_client.h")
485-
esp_eap_client_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem));
485+
esp_eap_client_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem) + 1);
486486
#else
487-
esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem));
487+
esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem) + 1);
488488
#endif
489489
}
490490

491491
if (client_crt) {
492492
#if __has_include("esp_eap_client.h")
493-
esp_eap_client_set_certificate_and_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0);
493+
esp_eap_client_set_certificate_and_key((uint8_t *)client_crt, strlen(client_crt) + 1, (uint8_t *)client_key, strlen(client_key) + 1, NULL, 0);
494494
#else
495-
esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0);
495+
esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_crt, strlen(client_crt) + 1, (uint8_t *)client_key, strlen(client_key) + 1, NULL, 0);
496496
#endif
497497
}
498498

0 commit comments

Comments
 (0)