mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Trim zero bytes from profile fields
This commit is contained in:
parent
a18d6b3fe4
commit
b745f1f902
1 changed files with 11 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue