Fix decoding empty array of complex type in RPM
This commit is contained in:
@@ -118,6 +118,14 @@ int rpm_ack_decode_service_request(
|
|||||||
more than one element to decode */
|
more than one element to decode */
|
||||||
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
||||||
rpm_property->value = value;
|
rpm_property->value = value;
|
||||||
|
|
||||||
|
/* Special case for an empty array - we decode it as null */
|
||||||
|
if (apdu_len && decode_is_closing_tag_number(apdu, 4)) {
|
||||||
|
/* NULL value has tag 0, that was already set by calloc */
|
||||||
|
decoded_len++;
|
||||||
|
apdu_len--;
|
||||||
|
apdu++;
|
||||||
|
} else {
|
||||||
while (value && (apdu_len > 0)) {
|
while (value && (apdu_len > 0)) {
|
||||||
len = bacapp_decode_known_property(apdu, (unsigned)apdu_len,
|
len = bacapp_decode_known_property(apdu, (unsigned)apdu_len,
|
||||||
value, rpm_object->object_type,
|
value, rpm_object->object_type,
|
||||||
@@ -154,6 +162,7 @@ int rpm_ack_decode_service_request(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (apdu_len && decode_is_opening_tag_number(apdu, 5)) {
|
} else if (apdu_len && decode_is_opening_tag_number(apdu, 5)) {
|
||||||
/* propertyAccessError */
|
/* propertyAccessError */
|
||||||
decoded_len++;
|
decoded_len++;
|
||||||
|
|||||||
Reference in New Issue
Block a user