Преглед изворни кода

Merge branch 'bugfix/ssid_passwords_null_terminated' into 'master'

wifi: Specify that SSID & Password fields should be NULL terminated strings

See merge request idf/esp-idf!4468
Angus Gratton пре 7 година
родитељ
комит
fa5bc5d58b
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5 5
      components/esp32/include/esp_wifi_types.h

+ 5 - 5
components/esp32/include/esp_wifi_types.h

@@ -208,9 +208,9 @@ typedef enum {
 
 
 /** @brief Soft-AP configuration settings for the ESP32 */
 /** @brief Soft-AP configuration settings for the ESP32 */
 typedef struct {
 typedef struct {
-    uint8_t ssid[32];           /**< SSID of ESP32 soft-AP */
-    uint8_t password[64];       /**< Password of ESP32 soft-AP */
-    uint8_t ssid_len;           /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
+    uint8_t ssid[32];           /**< SSID of ESP32 soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
+    uint8_t password[64];       /**< Password of ESP32 soft-AP. Null terminated string. */
+    uint8_t ssid_len;           /**< Optional length of SSID field. */
     uint8_t channel;            /**< Channel of ESP32 soft-AP */
     uint8_t channel;            /**< Channel of ESP32 soft-AP */
     wifi_auth_mode_t authmode;  /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */
     wifi_auth_mode_t authmode;  /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */
     uint8_t ssid_hidden;        /**< Broadcast SSID or not, default 0, broadcast the SSID */
     uint8_t ssid_hidden;        /**< Broadcast SSID or not, default 0, broadcast the SSID */
@@ -220,8 +220,8 @@ typedef struct {
 
 
 /** @brief STA configuration settings for the ESP32 */
 /** @brief STA configuration settings for the ESP32 */
 typedef struct {
 typedef struct {
-    uint8_t ssid[32];      /**< SSID of target AP*/
-    uint8_t password[64];  /**< password of target AP*/
+    uint8_t ssid[32];      /**< SSID of target AP. Null terminated string. */
+    uint8_t password[64];  /**< Password of target AP. Null terminated string.*/
     wifi_scan_method_t scan_method;    /**< do all channel scan or fast scan */
     wifi_scan_method_t scan_method;    /**< do all channel scan or fast scan */
     bool bssid_set;        /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
     bool bssid_set;        /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
     uint8_t bssid[6];     /**< MAC address of target AP*/
     uint8_t bssid[6];     /**< MAC address of target AP*/