Corrected context decoding bug in ReadPropertyMultiple client. Corrected ReadPropertyMultiple handling of objects that aren't supported. Added the context to application tags for the Load Control object.
This commit is contained in:
@@ -148,12 +148,24 @@ static void RPM_Property_List(
|
||||
break;
|
||||
}
|
||||
/* fill the count */
|
||||
pPropertyList->Required.count =
|
||||
property_list_count(pPropertyList->Required.pList);
|
||||
pPropertyList->Optional.count =
|
||||
property_list_count(pPropertyList->Optional.pList);
|
||||
pPropertyList->Proprietary.count =
|
||||
property_list_count(pPropertyList->Proprietary.pList);
|
||||
if (pPropertyList->Required.pList) {
|
||||
pPropertyList->Required.count =
|
||||
property_list_count(pPropertyList->Required.pList);
|
||||
} else {
|
||||
pPropertyList->Required.count = 0;
|
||||
}
|
||||
if (pPropertyList->Optional.pList) {
|
||||
pPropertyList->Optional.count =
|
||||
property_list_count(pPropertyList->Optional.pList);
|
||||
} else {
|
||||
pPropertyList->Optional.count = 0;
|
||||
}
|
||||
if (pPropertyList->Proprietary.pList) {
|
||||
pPropertyList->Proprietary.count =
|
||||
property_list_count(pPropertyList->Proprietary.pList);
|
||||
} else {
|
||||
pPropertyList->Proprietary.count = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -405,10 +417,8 @@ void handler_read_property_multiple(
|
||||
property_count =
|
||||
RPM_Object_Property_Count(&property_list,
|
||||
special_object_property);
|
||||
for (index = 0; index < property_count; index++) {
|
||||
object_property =
|
||||
RPM_Object_Property(&property_list,
|
||||
special_object_property, index);
|
||||
if (property_count == 0) {
|
||||
/* handle the error code - but use the special property */
|
||||
len =
|
||||
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
|
||||
npdu_len + apdu_len, sizeof(Handler_Transmit_Buffer),
|
||||
@@ -418,11 +428,31 @@ void handler_read_property_multiple(
|
||||
apdu_len += len;
|
||||
} else {
|
||||
apdu_len =
|
||||
abort_encode_apdu(&Handler_Transmit_Buffer
|
||||
[npdu_len], service_data->invoke_id,
|
||||
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
|
||||
service_data->invoke_id,
|
||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
||||
goto RPM_ABORT;
|
||||
}
|
||||
} else {
|
||||
for (index = 0; index < property_count; index++) {
|
||||
object_property =
|
||||
RPM_Object_Property(&property_list,
|
||||
special_object_property, index);
|
||||
len =
|
||||
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
|
||||
npdu_len + apdu_len, sizeof(Handler_Transmit_Buffer),
|
||||
object_type, object_instance, object_property,
|
||||
array_index);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
apdu_len =
|
||||
abort_encode_apdu(&Handler_Transmit_Buffer
|
||||
[npdu_len], service_data->invoke_id,
|
||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
||||
goto RPM_ABORT;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* handle an individual property */
|
||||
|
||||
@@ -85,6 +85,10 @@ static int rpm_ack_decode_service_request(
|
||||
&rpm_property->propertyArrayIndex);
|
||||
if (len <= 0) {
|
||||
old_rpm_property->next = NULL;
|
||||
if (rpm_object->listOfProperties == rpm_property) {
|
||||
/* was this the only property in the list? */
|
||||
rpm_object->listOfProperties = NULL;
|
||||
}
|
||||
free(rpm_property);
|
||||
break;
|
||||
}
|
||||
@@ -102,8 +106,15 @@ static int rpm_ack_decode_service_request(
|
||||
rpm_property->value = value;
|
||||
old_value = value;
|
||||
while (value && (apdu_len > 0)) {
|
||||
len =
|
||||
bacapp_decode_application_data(apdu, apdu_len, value);
|
||||
if (decode_is_context_specific(apdu)) {
|
||||
len =
|
||||
bacapp_decode_context_data(
|
||||
apdu, apdu_len, value,
|
||||
rpm_property->propertyIdentifier);
|
||||
} else {
|
||||
len =
|
||||
bacapp_decode_application_data(apdu, apdu_len, value);
|
||||
}
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
|
||||
Reference in New Issue
Block a user