Open royzhao opened 2 years ago
Wondering about this also - is this just to avoid very long parses? That magic number of 100 does not really make sense.
simple:
int offset = aOffset;
do {
final ParseResult result = parseWithResult(0, aBuf, offset, aLen-offset);
tlvs.add(result.tlv);
offset = result.offset;
} while(offset < aOffset+aLen);
passes all the tests
it's usually about not having unbound loops on possibly unverified input.
fair point. But this could be left as a setting
for(int i=0; i<100; i++) { ParseResult result = parseWithResult(0, aBuf, offset, aLen-offset); tlvs.add(result.tlv);
}
i think that code is better
int curOffset; do { ParseResult result = parseWithResult(0, aBuf, offset, aLen-offset); tlvs.add(result.tlv);
} while (curOffset<aOffset+aLen);