Skip to content

Commit

Permalink
refactor(dhcpserver): allow user to allocate DHCP Option 114 buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
jkingsman committed Apr 9, 2024
1 parent e3938fc commit ece07c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions components/esp_netif/lwip/esp_netif_lwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2335,10 +2335,7 @@ esp_err_t esp_netif_dhcps_option_api(esp_netif_api_msg_t *msg)
break;
}
case ESP_NETIF_CAPTIVEPORTAL_URI: {
/* unlike other flags/constant-sized IP addresses, we need to allocate for the URI */
char* captiveportal_uri = (char*) malloc((opt->len + 1) * sizeof(char));
strcpy(captiveportal_uri, opt->val);
opt_info = captiveportal_uri;
opt_info = (char *)opt->val;
break;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/protocols/http_server/captive_portal/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static void dhcp_set_captiveportal_url(void) {
ESP_LOGI(TAG, "Set up softAP with IP: %s", ip_addr);

// turn the IP into a URI
char captiveportal_uri[32];
char* captiveportal_uri = (char*) malloc(32 * sizeof(char));
strcpy(captiveportal_uri, "http://");
strcat(captiveportal_uri, ip_addr);

Expand Down

0 comments on commit ece07c8

Please sign in to comment.