- MMS client/server: accept empty bit strings

pull/179/head
Michael Zillgith 6 years ago
parent 8099734f11
commit daff495246

@ -319,7 +319,7 @@ mmsMsg_parseDataElement(Data_t* dataElement)
int size = dataElement->choice.bitstring.size;
if (size > 0) {
if (size >= 0) {
int maxSize = (size * 8);
int bitSize = maxSize - dataElement->choice.bitstring.bits_unused;
@ -335,6 +335,13 @@ mmsMsg_parseDataElement(Data_t* dataElement)
memcpy(value->value.bitString.buf,
dataElement->choice.bitstring.buf, size);
}
else if (bitSize == 0) {
value = (MmsValue*) GLOBAL_CALLOC(1, sizeof(MmsValue));
value->type = MMS_BIT_STRING;
value->value.bitString.size = 0;
value->value.bitString.buf = NULL;
}
else {
if (DEBUG_MMS_CLIENT)
printf("MMS CLIENT: error parsing data element (bit string padding problem)!\n");

@ -1188,6 +1188,7 @@ MmsValue_delete(MmsValue* self)
GLOBAL_FREEMEM(self->value.floatingPoint.buf);
break;
case MMS_BIT_STRING:
if (self->value.bitString.buf != NULL)
GLOBAL_FREEMEM(self->value.bitString.buf);
break;
case MMS_OCTET_STRING:

Loading…
Cancel
Save