Fixed GetEvent initialization of linked list (#1026)

* Fixed GetEvent usage of linked list by initializing next in all the examples and unit test.

* Secured GetEventInformation encoders by accepting NULL for APDU for determining the size, and exploit the NULL APDU for size checking during encoding. Secured the GetEventInformation decoders and removed the use of deprecated decoder API.
This commit is contained in:
Steve Karg
2025-06-20 13:34:39 -05:00
committed by GitHub
parent b0a97c6f75
commit 14f033ceda
7 changed files with 498 additions and 300 deletions
+16 -5
View File
@@ -55,29 +55,40 @@ size_t getevent_service_request_encode(
BACNET_STACK_EXPORT
int getevent_decode_service_request(
const uint8_t *apdu, unsigned apdu_len, BACNET_OBJECT_ID *object_id);
const uint8_t *apdu, unsigned apdu_size, BACNET_OBJECT_ID *object_id);
BACNET_STACK_EXPORT
int getevent_ack_encode_apdu_init(
uint8_t *apdu, size_t max_apdu, uint8_t invoke_id);
uint8_t *apdu, size_t apdu_size, uint8_t invoke_id);
BACNET_STACK_EXPORT
int getevent_information_ack_encode(
uint8_t *apdu, BACNET_GET_EVENT_INFORMATION_DATA *head);
BACNET_STACK_EXPORT
int getevent_ack_encode_apdu_data(
uint8_t *apdu,
size_t max_apdu,
size_t apdu_size,
BACNET_GET_EVENT_INFORMATION_DATA *get_event_data);
BACNET_STACK_EXPORT
int getevent_information_ack_end_encode(uint8_t *apdu, bool moreEvents);
BACNET_STACK_EXPORT
int getevent_ack_encode_apdu_end(
uint8_t *apdu, size_t max_apdu, bool moreEvents);
uint8_t *apdu, size_t apdu_size, bool moreEvents);
BACNET_STACK_EXPORT
int getevent_ack_decode_service_request(
const uint8_t *apdu,
int apdu_len, /* total length of the apdu */
int apdu_size,
BACNET_GET_EVENT_INFORMATION_DATA *get_event_data,
bool *moreEvents);
BACNET_STACK_EXPORT
void getevent_information_link_array(
BACNET_GET_EVENT_INFORMATION_DATA *array, size_t size);
#ifdef __cplusplus
}
#endif /* __cplusplus */