diff --git a/CHANGELOG.md b/CHANGELOG.md index d47a3a69..106e1df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The git repositories are hosted at the following sites: * https://bacnet.sourceforge.net/ * https://github.com/bacnet-stack/bacnet-stack/ -## [Unreleased] - 2026-02-02 +## [Unreleased] - 2026-02-05 ### Security @@ -122,6 +122,8 @@ The git repositories are hosted at the following sites: ### Fixed +* Fixed You-Are-Request encoding and decoding to use object-id instead + of unsigned. (#1220) * Fixed handling for abort and reject errors in Write Property service. (#1216) * Fixed lighting output object lighting-commands for warn-off and warn-relinquish when an update at the specified priority slot diff --git a/src/bacnet/youare.c b/src/bacnet/youare.c index ab862154..b81c9905 100644 --- a/src/bacnet/youare.c +++ b/src/bacnet/youare.c @@ -64,7 +64,7 @@ int you_are_request_encode( apdu += len; } if (device_id < BACNET_MAX_INSTANCE) { - len = encode_application_unsigned(apdu, device_id); + len = encode_application_object_id(apdu, OBJECT_DEVICE, device_id); apdu_len += len; if (apdu) { apdu += len; @@ -148,6 +148,8 @@ int you_are_request_decode( { int len = 0, apdu_len = 0; BACNET_UNSIGNED_INTEGER unsigned_value = 0; + BACNET_OBJECT_TYPE object_type; + uint32_t object_instance; if (!apdu) { return BACNET_STATUS_ERROR; @@ -183,17 +185,16 @@ int you_are_request_decode( } else { return BACNET_STATUS_ERROR; } - len = bacnet_unsigned_application_decode( - &apdu[apdu_len], apdu_size - apdu_len, &unsigned_value); + len = bacnet_object_id_application_decode( + &apdu[apdu_len], apdu_size - apdu_len, &object_type, &object_instance); if (len > 0) { apdu_len += len; - if (unsigned_value <= UINT32_MAX) { - if (device_id) { - *device_id = (uint32_t)unsigned_value; - } - } else { + if (object_type != OBJECT_DEVICE) { return BACNET_STATUS_ERROR; } + if (device_id) { + *device_id = object_instance; + } } else if (len == 0) { /* optional - skip apdu_len increment */ if (device_id) {