Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ The git repositories are hosted at the following sites:

## [Unreleased]

### Security

- Fix [bug#79] out of bounds jump in h_apdu.c:apdu_handler (#446)

### Fixed

- Fix segfault on mstp cleanup on linux port (#445)
- Fix minimal config by adding bitstring (#443)
- Fix WhoIs app APDU timeout (#444)
Expand Down
24 changes: 19 additions & 5 deletions src/bacnet/basic/service/h_apdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ bool apdu_confirmed_simple_ack_service(
return status;
}

/**
* @brief Set the the BACnet Simple Ack Service handler
* @param service_choice [in] BACnet confirmed service choice
* @param pFunction [in] handler for the service
*/
void apdu_set_confirmed_simple_ack_handler(
BACNET_CONFIRMED_SERVICE service_choice,
confirmed_simple_ack_function pFunction)
Expand All @@ -302,11 +307,18 @@ void apdu_set_confirmed_simple_ack_handler(
}
}

/**
* @brief Set the the BACnet Confirmed Ack Service handler
* @param service_choice [in] BACnet confirmed service choice
* @param pFunction [in] handler for the service
*/
void apdu_set_confirmed_ack_handler(
BACNET_CONFIRMED_SERVICE service_choice, confirmed_ack_function pFunction)
{
if (!apdu_confirmed_simple_ack_service(service_choice)) {
Confirmed_ACK_Function[service_choice].complex = pFunction;
if (service_choice < MAX_BACNET_CONFIRMED_SERVICE) {
Confirmed_ACK_Function[service_choice].complex = pFunction;
}
}
}

Expand Down Expand Up @@ -640,11 +652,13 @@ void apdu_handler(BACNET_ADDRESS *src,
service_request = &apdu[len];
service_request_len = apdu_len - (uint16_t)len;
if (!apdu_confirmed_simple_ack_service(service_choice)) {
if (Confirmed_ACK_Function[service_choice]
if (service_choice < MAX_BACNET_CONFIRMED_SERVICE) {
if (Confirmed_ACK_Function[service_choice]
.complex != NULL) {
Confirmed_ACK_Function[service_choice].complex(
service_request, service_request_len, src,
&service_ack_data);
Confirmed_ACK_Function[service_choice].complex(
service_request, service_request_len, src,
&service_ack_data);
}
}
tsm_free_invoke_id(invoke_id);
}
Expand Down