From 4c8e2ca6d489661c23e401a20e2e9681deb8c5b1 Mon Sep 17 00:00:00 2001 From: Katsuyuki Hirayama Date: Fri, 11 Dec 2015 11:44:33 +0900 Subject: [PATCH] Limit the accepted length of SIM PIN to 8 digits Adding the upper limit results in the correct error message being displayed to the end user - "Type a PIN that is 4 to 8 numbers." Limiting the SIM PIN length to between 4-8 digits is part of the GSM SIM security requirements. See GSM 02.17 version 5.0.1, Section 5.6 PIN Management. Bug: 31331481 Test: 1. Insert a SIM card with SIM PIN enabled 2. Start the device 3. Enter a SIM PIN with a length > 8 Change-Id: Ie5fba1c79074910b0bfd54df51e4412bbf32f5fe --- .../com/android/keyguard/KeyguardSimPinViewController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java index e04bfdc3868d3..97324f0c1e90f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java @@ -134,7 +134,9 @@ public class KeyguardSimPinViewController protected void verifyPasswordAndUnlock() { String entry = mPasswordEntry.getText(); - if (entry.length() < 4) { + // A SIM PIN is 4 to 8 decimal digits according to + // GSM 02.17 version 5.0.1, Section 5.6 PIN Management + if ((entry.length() < 4) || (entry.length() > 8)) { // otherwise, display a message to the user, and don't submit. mMessageAreaController.setMessage( com.android.systemui.R.string.kg_invalid_sim_pin_hint);