mirror of https://github.com/apache/cloudstack.git
CID 1264632: Rely on a known and widely available encoding UTF8
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 0763b5576d)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
7699c70ade
commit
70f9db34cb
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.cloud.utils;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class ConstantTimeComparator {
|
||||
|
||||
public static boolean compareBytes(byte[] b1, byte[] b2) {
|
||||
|
|
@ -34,6 +36,7 @@ public class ConstantTimeComparator {
|
|||
}
|
||||
|
||||
public static boolean compareStrings(String s1, String s2) {
|
||||
return compareBytes(s1.getBytes(), s2.getBytes());
|
||||
final Charset encoding = Charset.forName("UTF-8");
|
||||
return compareBytes(s1.getBytes(encoding), s2.getBytes(encoding));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue