[libbacnet]: bacapp_data_len() + bacnet_tag_number_and_value_decode() (#453)

* Bugfix: bacapp_data_len() + bacnet_tag_number_and_value_decode()

* Fix bacnet_tag_number_and_value_decode function.
Add read buffer safe functions for opening, closing, context specific tags.
Fix bacapp_data_len function changes as indicated by unit testing.

* refactor bacapp_data_len
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
anthony-crystalpeak
2023-07-31 14:50:14 -07:00
committed by GitHub
parent 28de333b6e
commit acb3b0f57d
4 changed files with 134 additions and 48 deletions
+2 -2
View File
@@ -61,11 +61,11 @@ static void testWritePropertyTag(BACNET_APPLICATION_DATA_VALUE *value)
wpdata.application_data_len =
bacapp_encode_application_data(&wpdata.application_data[0], value);
len = wp_encode_apdu(&apdu[0], invoke_id, &wpdata);
zassert_not_equal(len, 0, NULL);
zassert_not_equal(len, 0, "len=%d", len);
/* decode the data */
apdu_len = len;
len = wp_decode_apdu(&apdu[0], apdu_len, &test_invoke_id, &test_data);
zassert_not_equal(len, -1, NULL);
zassert_true(len > 0, "len=%d", len);
zassert_equal(test_data.object_type, wpdata.object_type, NULL);
zassert_equal(test_data.object_instance, wpdata.object_instance, NULL);
zassert_equal(test_data.object_property, wpdata.object_property, NULL);