Fixed Get Event Handler to additionally check its own buffer length.

Get event handler checks only if APDU length is less than Max APDU of device that has requested list of events, but it does not check its own Max APDU to see if response is too long to fit in Handler_Transmit_Buffer. Thanks, Daniel Blazevic!
This commit is contained in:
skarg
2016-04-20 19:42:41 +00:00
parent 3362eecdff
commit cc7e9b539d
+13 -7
View File
@@ -44,7 +44,7 @@
static get_event_info_function Get_Event_Info[MAX_BACNET_OBJECT_TYPE];
/** print eventState
/** print eventState
*/
void ge_ack_print_data(
BACNET_GET_EVENT_INFORMATION_DATA * data,
@@ -171,18 +171,24 @@ void handler_get_event_information(
goto GET_EVENT_ERROR;
}
apdu_len += len;
if (apdu_len >= service_data->max_resp - 2) {
/* Device must be able to fit minimum one event information.
Length of one event informations needs more than 50 octets. */
if (service_data->max_resp < 128) {
if ((apdu_len >= service_data->max_resp - 2) ||
(apdu_len >= MAX_APDU - 2)) {
/* Device must be able to fit minimum
one event information.
Length of one event informations needs
more than 50 octets. */
if ((service_data->max_resp < 128) ||
(MAX_APDU < 128)) {
len = BACNET_STATUS_ABORT;
error = true;
goto GET_EVENT_ERROR;
} else
} else {
more_events = true;
}
break;
} else
} else {
pdu_len += len;
}
} else if (valid_event < 0) {
break;
}