- MmsValue_decodeMmsData: add support for empty visible-string, mms-string, and octet-string values (#506)

pull/515/head
Michael Zillgith 1 year ago
parent 05f32320e1
commit 7d03b582a9

@ -171,9 +171,12 @@ MmsValue_decodeMmsData(uint8_t* buffer, int bufPos, int bufferLength, int* endBu
if (bufPos < 0) if (bufPos < 0)
goto exit_with_error; goto exit_with_error;
/* if not indefinite length end tag, data length must be > 0 */ /* if not indefinite length end tag, visible-string, mms-string, or octet-string, data length must be > 0 */
if ((tag != 0) && (dataLength == 0)) if (tag != 0)
goto exit_with_error; {
if (tag != 0x8a && tag != 0x90 && tag != 0x89 && dataLength == 0)
goto exit_with_error;
}
switch (tag) { switch (tag) {
@ -192,8 +195,8 @@ MmsValue_decodeMmsData(uint8_t* buffer, int bufPos, int bufferLength, int* endBu
int i; int i;
for (i = 0; i < elementCount; i++) { for (i = 0; i < elementCount; i++)
{
int elementLength; int elementLength;
int newBufPos = BerDecoder_decodeLength(buffer, &elementLength, bufPos + 1, dataEndBufPos); int newBufPos = BerDecoder_decodeLength(buffer, &elementLength, bufPos + 1, dataEndBufPos);
@ -304,7 +307,8 @@ MmsValue_decodeMmsData(uint8_t* buffer, int bufPos, int bufferLength, int* endBu
break; break;
case 0x91: /* MMS_UTC_TIME */ case 0x91: /* MMS_UTC_TIME */
if (dataLength == 8) { if (dataLength == 8)
{
value = MmsValue_newUtcTime(0); value = MmsValue_newUtcTime(0);
MmsValue_setUtcTimeByBuffer(value, buffer + bufPos); MmsValue_setUtcTimeByBuffer(value, buffer + bufPos);
bufPos += dataLength; bufPos += dataLength;

Loading…
Cancel
Save