Secure the BVLC decoders by replacing deprecated primitive and complex data decoders. (#1241)

This commit is contained in:
Steve Karg
2026-02-20 10:30:46 -06:00
committed by GitHub
parent 7d78889aa9
commit 578f507125
3 changed files with 44 additions and 94 deletions
+14
View File
@@ -520,6 +520,9 @@ static void test_BVLC_Broadcast_Distribution_Table_Encode(void)
status = bvlc_broadcast_distribution_table_entry_append(
&bdt_list[0], &bdt_entry);
zassert_true(status, NULL);
status = bvlc_broadcast_distribution_table_entry_insert(
&bdt_list[0], &bdt_entry, i);
zassert_true(status, NULL);
}
test_count = bvlc_broadcast_distribution_table_count(&bdt_list[0]);
if (test_count != count) {
@@ -698,6 +701,7 @@ static int test_BVLC_Foreign_Device_Table_Setup(
uint16_t ttl_seconds = 12345;
bool status = false;
BACNET_IP_ADDRESS dest_address = { 0 };
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY test_entry = { 0 };
status = bvlc_address_from_ascii(&dest_address, "192.168.0.1");
zassert_true(status, NULL);
@@ -712,6 +716,12 @@ static int test_BVLC_Foreign_Device_Table_Setup(
status = bvlc_foreign_device_table_entry_add(
fdt_list, &dest_address, ttl_seconds);
zassert_true(status, NULL);
bvlc_address_copy(&test_entry.dest_address, &dest_address);
test_entry.ttl_seconds = ttl_seconds;
test_entry.ttl_seconds_remaining = ttl_seconds + 30;
status =
bvlc_foreign_device_table_entry_insert(fdt_list, &test_entry, i);
zassert_true(status, NULL);
}
test_count = bvlc_foreign_device_table_count(fdt_list);
zassert_equal(test_count, count, NULL);
@@ -733,6 +743,7 @@ static void test_BVLC_Read_Foreign_Device_Table_Ack(void)
uint16_t count = 0;
uint16_t test_count = 0;
BACNET_IP_FOREIGN_DEVICE_TABLE_ENTRY fdt_list[5] = { 0 };
bool status = false;
count = sizeof(fdt_list) / sizeof(fdt_list[0]);
test_count = test_BVLC_Foreign_Device_Table_Setup(fdt_list, count);
@@ -744,6 +755,9 @@ static void test_BVLC_Read_Foreign_Device_Table_Ack(void)
zassert_equal(test_count, count, NULL);
test_BVLC_Read_Foreign_Device_Table_Ack_Message(fdt_list);
/* cleanup */
status = bvlc_foreign_device_table_entry_delete(
fdt_list, &fdt_list[0].dest_address);
zassert_true(status, NULL);
bvlc_foreign_device_table_valid_clear(&fdt_list[0]);
test_count = bvlc_foreign_device_table_valid_count(fdt_list);
zassert_equal(test_count, 0, NULL);