From b7b5d96b3bfd966c4154b72fa6ce69d34ec3c64c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 Mar 2020 12:38:38 -0600 Subject: [PATCH] TunnelDetailFragment: avoid integer overflow Signed-off-by: Jason A. Donenfeld --- .../com/wireguard/android/fragment/TunnelDetailFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java b/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java index e2adecc3..e6ac7092 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java @@ -44,7 +44,7 @@ public class TunnelDetailFragment extends BaseFragment { return requireContext().getString(R.string.transfer_kibibytes, bytes / 1024.0); else if (bytes < 1024 * 1024 * 1024) return requireContext().getString(R.string.transfer_mibibytes, bytes / (1024.0 * 1024.0)); - else if (bytes < 1024 * 1024 * 1024 * 1024) + else if (bytes < 1024 * 1024 * 1024 * 1024L) return requireContext().getString(R.string.transfer_gibibytes, bytes / (1024.0 * 1024.0 * 1024.0)); return requireContext().getString(R.string.transfer_tibibytes, bytes / (1024.0 * 1024.0 * 1024.0) / 1024.0); }