Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Snippets Groups Projects
Commit 257732fb authored by Nathan Harold's avatar Nathan Harold
Browse files

Improve the Safety Checks on IccCardStatus.toString()

Tighter range checks in the toString() method to cross
validate the application array against the app indices.

Bug: 62459080
Test: none
Change-Id: I078315f5ea773eb117303cccfcedda06280fffab
parent 9f1c5080
Branches
No related tags found
No related merge requests found
...@@ -116,30 +116,33 @@ public class IccCardStatus { ...@@ -116,30 +116,33 @@ public class IccCardStatus {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("IccCardState {").append(mCardState).append(",") sb.append("IccCardState {").append(mCardState).append(",")
.append(mUniversalPinState) .append(mUniversalPinState)
.append(",num_apps=").append(mApplications.length) .append(",num_apps=").append(mApplications.length);
.append(",gsm_id=").append(mGsmUmtsSubscriptionAppIndex);
if (mGsmUmtsSubscriptionAppIndex >=0 sb.append(",gsm_id=").append(mGsmUmtsSubscriptionAppIndex);
&& mGsmUmtsSubscriptionAppIndex <CARD_MAX_APPS) { if (mApplications != null
&& mGsmUmtsSubscriptionAppIndex >= 0
&& mGsmUmtsSubscriptionAppIndex < mApplications.length) {
app = mApplications[mGsmUmtsSubscriptionAppIndex]; app = mApplications[mGsmUmtsSubscriptionAppIndex];
sb.append(app == null ? "null" : app); sb.append(app == null ? "null" : app);
} }
sb.append(",cdma_id=").append(mCdmaSubscriptionAppIndex); sb.append(",cdma_id=").append(mCdmaSubscriptionAppIndex);
if (mCdmaSubscriptionAppIndex >=0 if (mApplications != null
&& mCdmaSubscriptionAppIndex <CARD_MAX_APPS) { && mCdmaSubscriptionAppIndex >= 0
&& mCdmaSubscriptionAppIndex < mApplications.length) {
app = mApplications[mCdmaSubscriptionAppIndex]; app = mApplications[mCdmaSubscriptionAppIndex];
sb.append(app == null ? "null" : app); sb.append(app == null ? "null" : app);
} }
sb.append(",ims_id=").append(mImsSubscriptionAppIndex); sb.append(",ims_id=").append(mImsSubscriptionAppIndex);
if (mImsSubscriptionAppIndex >=0 if (mApplications != null
&& mImsSubscriptionAppIndex <CARD_MAX_APPS) { && mImsSubscriptionAppIndex >= 0
&& mImsSubscriptionAppIndex < mApplications.length) {
app = mApplications[mImsSubscriptionAppIndex]; app = mApplications[mImsSubscriptionAppIndex];
sb.append(app == null ? "null" : app); sb.append(app == null ? "null" : app);
} }
sb.append("}"); sb.append("}");
return sb.toString(); return sb.toString();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment