- MMS client/server: accept empty bit strings

pull/147/head
Michael Zillgith 6 years ago
parent 5b55605fb0
commit b9ded374e3

@ -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");

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

Loading…
Cancel
Save