1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-11 19:27:50 +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:
MrYoranimo 2024-09-23 09:32:22 +02:00 committed by José Rebelo
parent 92fd556c5f
commit 47acfd2775

View File

@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
@ -140,9 +141,7 @@ public class XiaomiFWHelper {
return false;
}
try {
Integer.parseInt(id);
} catch (final Exception e) {
if (!Pattern.matches("^\\d+$", id)) {
LOG.warn("Id {} not a number", id);
return false;
}