mirror of
https://github.com/aljazceru/signal-cli.git
synced 2026-01-01 21:34:34 +01:00
Trim zero bytes from profile fields
This commit is contained in:
@@ -18,8 +18,8 @@ public class ProfileUtils {
|
||||
var profileCipher = new ProfileCipher(profileKey);
|
||||
try {
|
||||
var name = decrypt(encryptedProfile.getName(), profileCipher);
|
||||
var about = decrypt(encryptedProfile.getAbout(), profileCipher);
|
||||
var aboutEmoji = decrypt(encryptedProfile.getAboutEmoji(), profileCipher);
|
||||
var about = trimZeros(decrypt(encryptedProfile.getAbout(), profileCipher));
|
||||
var aboutEmoji = trimZeros(decrypt(encryptedProfile.getAboutEmoji(), profileCipher));
|
||||
|
||||
final var nameParts = splitName(name);
|
||||
return new Profile(System.currentTimeMillis(),
|
||||
@@ -95,4 +95,13 @@ public class ProfileUtils {
|
||||
return new Pair<>(parts[0], parts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
static String trimZeros(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int pos = str.indexOf(0);
|
||||
return pos == -1 ? str : str.substring(0, pos);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user