Skip to content

Commit

Permalink
Limit the maximum length of the download URL for the OTA binary since…
Browse files Browse the repository at this point in the history
… the receive buffer on the nina firmware can't hold more than 128 bytes (arduino-libraries#131)
  • Loading branch information
aentinger authored Sep 16, 2020
1 parent b6a6180 commit 6054f43
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/WiFiStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ class WiFiStorageClass
return true;
}
static bool downloadOTA(const char * url, uint8_t * res_ota_download = NULL) {
/* The buffer within the nina firmware allows a maximum
* url size of 128 bytes. It's better to prevent the
* transmission of over-sized URL as soon as possible.
*/
if (strlen(url) > 128)
return false;

uint8_t const res = WiFiDrv::downloadOTA(url, strlen(url));
if (res_ota_download)
*res_ota_download = res;
Expand Down

0 comments on commit 6054f43

Please sign in to comment.