From 6054f43840c76a87e885d37663bb73063f1de55e Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 16 Sep 2020 14:49:36 +0200 Subject: [PATCH] Limit the maximum length of the download URL for the OTA binary since the receive buffer on the nina firmware can't hold more than 128 bytes (#131) --- src/WiFiStorage.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/WiFiStorage.h b/src/WiFiStorage.h index 54f744a0..fdccfc41 100644 --- a/src/WiFiStorage.h +++ b/src/WiFiStorage.h @@ -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;