Repository: cloudstack Updated Branches: refs/heads/4.4 7699c70ad -> 70f9db34c
CID 1264632: Rely on a known and widely available encoding UTF8 Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> (cherry picked from commit 0763b5576dde92b1c4ecfbce3b3b593ed0ca90bc) Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/70f9db34 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/70f9db34 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/70f9db34 Branch: refs/heads/4.4 Commit: 70f9db34cb1a9b0dafbf985e9a590cb73528e598 Parents: 7699c70 Author: Rohit Yadav <rohit.ya...@shapeblue.com> Authored: Tue Jan 20 07:47:34 2015 +0530 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Tue Jan 20 07:49:56 2015 +0530 ---------------------------------------------------------------------- utils/src/com/cloud/utils/ConstantTimeComparator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/70f9db34/utils/src/com/cloud/utils/ConstantTimeComparator.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/ConstantTimeComparator.java b/utils/src/com/cloud/utils/ConstantTimeComparator.java index 4d4a595..baf2bc2 100644 --- a/utils/src/com/cloud/utils/ConstantTimeComparator.java +++ b/utils/src/com/cloud/utils/ConstantTimeComparator.java @@ -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)); } }