diff --git a/src/components/ble/weather/WeatherService.cpp b/src/components/ble/weather/WeatherService.cpp index 513bb2a16b..83f1c22c29 100644 --- a/src/components/ble/weather/WeatherService.cpp +++ b/src/components/ble/weather/WeatherService.cpp @@ -74,6 +74,11 @@ namespace Pinetime { return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; } + // Enforce a reasonable limit to the amount of RAM that can be used + if (GetTimelineLength() > WeatherData::eventtype::Length) { + return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; + } + switch (static_cast(tmpEventType)) { case WeatherData::eventtype::AirQuality: { std::unique_ptr airquality = std::make_unique();