mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Fossil/Skagen Hybrids: Fix crash on multi-byte unicode characters in menu
The FosslAppWriter was writing string length instead of the bytes length into the wapp file, causing a crash when reading the file. Fixes #3577
This commit is contained in:
parent
ad256fade0
commit
122ff5f7f4
@ -146,7 +146,7 @@ public class FossilAppWriter {
|
|||||||
for (String filename : stringsMap.keySet()) {
|
for (String filename : stringsMap.keySet()) {
|
||||||
output.write((byte)filename.length() + 1);
|
output.write((byte)filename.length() + 1);
|
||||||
output.write(StringUtils.terminateNull(filename).getBytes(StandardCharsets.UTF_8));
|
output.write(StringUtils.terminateNull(filename).getBytes(StandardCharsets.UTF_8));
|
||||||
output.write(shortToLEBytes((short)(stringsMap.get(filename).length() + 1)));
|
output.write(shortToLEBytes((short)(stringsMap.get(filename).getBytes(StandardCharsets.UTF_8).length + 1)));
|
||||||
output.write(StringUtils.terminateNull(stringsMap.get(filename)).getBytes(StandardCharsets.UTF_8));
|
output.write(StringUtils.terminateNull(stringsMap.get(filename)).getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
return output.toByteArray();
|
return output.toByteArray();
|
||||||
|
Loading…
Reference in New Issue
Block a user