mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-28 02:27:32 +01:00
Fix body_length overflow for long notifications.
The body_length field in the header is only one byte (byte 8). If it it is set to 256 it overflows to 0 wich results in a corrupt notification. So the maximum body length is 255.
This commit is contained in:
parent
86ccd408cd
commit
3b6f3b11bb
@ -731,8 +731,8 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
int subject_length = 0;
|
int subject_length = 0;
|
||||||
int body_length = notificationSpec.body.getBytes(StandardCharsets.UTF_8).length;
|
int body_length = notificationSpec.body.getBytes(StandardCharsets.UTF_8).length;
|
||||||
if (body_length > 256) {
|
if (body_length > 255) {
|
||||||
body_length = 256;
|
body_length = 255;
|
||||||
}
|
}
|
||||||
int notification_length = body_length;
|
int notification_length = body_length;
|
||||||
byte[] subject = null;
|
byte[] subject = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user