]> granicus.if.org Git - esp-idf/commitdiff
smartconfig_ack.c : Fixed the declaration of remote_ip in sc_ack_send_task()
authorSachin Parekh <sachin.parekh@espressif.com>
Tue, 3 Jul 2018 10:39:49 +0000 (16:09 +0530)
committerSachin Parekh <sachin.parekh@espressif.com>
Tue, 3 Jul 2018 10:58:24 +0000 (16:28 +0530)
remote_ip was declared to be a pointer to an address that was
overwritten in later stage thus changing the address pointed by remote_ip

esp_smartconfig.h : Fixed a typo. station_config to wifi_config_t

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
components/esp32/include/esp_smartconfig.h
components/smartconfig_ack/smartconfig_ack.c

index 916c4c1706db8006b5d7437a1e929123a75e6eec..34cf8667ab923e9d49802da528e64abbbcd89b9f 100644 (file)
@@ -42,7 +42,7 @@ typedef enum {
   *
   * @param  status  Status of SmartConfig:
   *    - SC_STATUS_GETTING_SSID_PSWD : pdata is a pointer of smartconfig_type_t, means config type.
-  *    - SC_STATUS_LINK : pdata is a pointer of struct station_config.
+  *    - SC_STATUS_LINK : pdata is a pointer to wifi_config_t.
   *    - SC_STATUS_LINK_OVER : pdata is a pointer of phone's IP address(4 bytes) if pdata unequal NULL.
   *    - otherwise : parameter void *pdata is NULL.
   * @param  pdata  According to the different status have different values.
index be5c4a676d3cc7ff258c6e5c2ce5ab2f1ee82c1a..f84aad367261021fbfa201378b1a9a399eeb1032 100644 (file)
@@ -46,7 +46,8 @@ static void sc_ack_send_task(void *pvParameters)
 {
     sc_ack_t *ack = (sc_ack_t *)pvParameters;
     tcpip_adapter_ip_info_t local_ip;
-    uint8_t *remote_ip = ack->ctx.ip;
+    uint8_t remote_ip[4];
+    memcpy(remote_ip, ack->ctx.ip, sizeof(remote_ip));
     int remote_port = (ack->type == SC_ACK_TYPE_ESPTOUCH) ? SC_ACK_TOUCH_SERVER_PORT : SC_ACK_AIRKISS_SERVER_PORT;
     struct sockaddr_in server_addr;
     socklen_t sin_size = sizeof(server_addr);