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

Commit 7c27ac64 authored by Wink Saville's avatar Wink Saville
Browse files

Do not clear good TLVs when a error occurs decoding.

In change Ief74d0e4f4f28dff7a435e9dab1fab1ca1d9bfaf with a sha1 of
e81932e9 it seemed like a good idea
to throw away all TLV's on errors. In retrospect that was probably
not a good idea. For example on the MTN Ghana SIM the error
occurs because of some 0 pad bytes at the end, all of the actual
TLV's are good, so throwing away everything is unreasonable. Instead
accepting what is valid seems a better approach.

Also, add a couple debug lines on error paths.

Change-Id: I4add0c9cd242f46e0ef8700229d0ec755b9e4c4c
parent 18798131
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -427,11 +427,11 @@ public class CatService extends Handler implements AppInterface {
                    }
                    break;
                default:
                    CatLog.d(this, "encodeOptionalTags() Unsupported Cmd:" + cmdDet.typeOfCommand);
                    CatLog.d(this, "encodeOptionalTags() Unsupported Cmd details=" + cmdDet);
                    break;
            }
        } else {
            CatLog.d(this, "encodeOptionalTags() bad Cmd:" + cmdDet.typeOfCommand);
            CatLog.d(this, "encodeOptionalTags() bad Cmd details=" + cmdDet);
        }
    }

+0 −1
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ class ComprehensionTlv {
                startIndex = ctlv.mValueIndex + ctlv.mLength;
            } else {
                CatLog.d(LOG_TAG, "decodeMany: ctlv is null, stop decoding");
                items.clear();
                break;
            }
        }