From 7a9f2ad7234e716dc448e6e6c4d59673c16a6184 Mon Sep 17 00:00:00 2001 From: Malcolm Chen Date: Wed, 6 Nov 2019 11:07:09 -0800 Subject: Correct boundary check and add log. Bug: 142514392 Test: sanity Change-Id: Icf3e7d2c31c8d7a9da371d51cffc8721d8ba8fa1 --- src/com/android/stk/StkAppService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/com') diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java index d1951db..4bd7937 100644 --- a/src/com/android/stk/StkAppService.java +++ b/src/com/android/stk/StkAppService.java @@ -557,7 +557,10 @@ public class StkAppService extends Service implements Runnable { ((CatCmdMessage)msg.obj).getCmdType()!= null) { CatLog.d(LOG_TAG, "cmdName[" + ((CatCmdMessage)msg.obj).getCmdType().name() + "]"); } - if (slotId > mStkContext.length || mStkContext[slotId] == null) return; + if (slotId >= mStkContext.length || mStkContext[slotId] == null) { + CatLog.d(LOG_TAG, "invalid slotId " + slotId); + return; + } mStkContext[slotId].mOpCode = opcode; switch (opcode) { -- cgit v1.2.3