Improved Temperature parsing

main
Avamander 2021-12-02 23:49:51 +07:00
parent 4a8f72bd1e
commit 58d454b11f
1 changed files with 1 additions and 1 deletions

@ -195,7 +195,7 @@ namespace Pinetime {
int64_t tmpTemperature = 0; int64_t tmpTemperature = 0;
QCBORDecode_GetInt64InMapSZ(&decodeContext, "Temperature", &tmpTemperature); QCBORDecode_GetInt64InMapSZ(&decodeContext, "Temperature", &tmpTemperature);
if (tmpTemperature < 0 || tmpTemperature > 65535) { if (tmpTemperature < -32768 || tmpTemperature > 32767) {
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
} }
temperature->temperature = tmpTemperature; // NOLINT(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) temperature->temperature = tmpTemperature; // NOLINT(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions)