Skip to content

Commit

Permalink
- client: fixed bug in parsing initiate response message
Browse files Browse the repository at this point in the history
  • Loading branch information
mzillgith committed Mar 9, 2018
1 parent 4997104 commit e0bc9b9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/mms/iso_mms/client/mms_client_initiate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e0bc9b9

Please sign in to comment.