- client: fixed bug in parsing initiate response message

v1.1
Michael Zillgith 8 years ago
parent 4997104396
commit e0bc9b9f37

@ -170,20 +170,30 @@ mmsClient_parseInitiateResponse(MmsConnection self)
self->parameters.maxServOutstandingCalled = DEFAULT_MAX_SERV_OUTSTANDING_CALLED;
self->parameters.maxServOutstandingCalling = DEFAULT_MAX_SERV_OUTSTANDING_CALLING;
int bufPos = 0;
int bufPos = 1; /* ignore tag - already checked */
int maxBufPos = ByteBuffer_getSize(self->lastResponse);
uint8_t* buffer = ByteBuffer_getBuffer(self->lastResponse);
int length;
bufPos = BerDecoder_decodeLength(buffer, &length, bufPos, maxBufPos);
if (bufPos < 0)
return false;
if (bufPos + length > maxBufPos)
return false;
while (bufPos < maxBufPos) {
uint8_t tag = buffer[bufPos++];
int length;
bufPos = BerDecoder_decodeLength(buffer, &length, bufPos, maxBufPos);
if (bufPos < 0) {
// TODO write initiate error PDU!
if (bufPos < 0)
return false;
if (bufPos + length > maxBufPos)
return false;
}
switch (tag) {
case 0x80: /* local-detail-calling */

Loading…
Cancel
Save