mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-12 11:47:46 +01:00
Xiaomi: fix watchface ID check
The identifier for a watch face is stored as a decimal number in ASCII. Since there are 64 bytes available to store the identifier, the highest value to be expected is 10^(64*10), which exceeds the limit of a 32-bit integer.
This commit is contained in:
parent
92fd556c5f
commit
47acfd2775
@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||||
@ -140,9 +141,7 @@ public class XiaomiFWHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (!Pattern.matches("^\\d+$", id)) {
|
||||||
Integer.parseInt(id);
|
|
||||||
} catch (final Exception e) {
|
|
||||||
LOG.warn("Id {} not a number", id);
|
LOG.warn("Id {} not a number", id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user