1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-18 14:47:46 +01:00

Huami: Prevent setting an MTU of < 23, which is either a special value or a parsing error of Gadgetbridge

This fixes a problem where writeToChunked algorithm results in out of bounds writes or an endless loop.

Closes #1936
This commit is contained in:
Andreas Shimokawa 2020-08-02 13:11:41 +02:00
parent f9dc625c5c
commit a619fdb168

View File

@ -1279,6 +1279,10 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
if (!prefs.getBoolean(PREF_ALLOW_HIGH_MTU, false)) { if (!prefs.getBoolean(PREF_ALLOW_HIGH_MTU, false)) {
break; break;
} }
if (mtu < 23) {
LOG.error("Device announced unreasonable low MTU of " + mtu + ", ignoring");
break;
}
mMTU = mtu; mMTU = mtu;
/* /*
* not really sure if this would make sense, is this event already a proof of a successful MTU * not really sure if this would make sense, is this event already a proof of a successful MTU