fix(sacn): validate universe range (1..63999), add boundary tests

Universe 0 and values >63999 are reserved per E1.31 spec and must be rejected.
Priority is deliberately not validated (compared relatively in later tasks only).

Test coverage:
- test_universe_zero_rejected: rejects universe 0
- test_universe_too_high_rejected: rejects universe 64000
- test_universe_is_read: continues to accept universe 63999
This commit is contained in:
Michael Sauer
2026-09-19 23:49:47 +02:00
parent cdbbe31831
commit f09a51088a
2 changed files with 26 additions and 2 deletions
+16
View File
@@ -178,6 +178,20 @@ static void test_universe_is_read(void)
TEST_ASSERT_EQUAL_UINT8(7, p.sequence);
}
static void test_universe_zero_rejected(void)
{
nl_e131_packet_t p;
build(0, 100, 0, 0, 6);
TEST_ASSERT_FALSE(nl_e131_parse(pkt, pkt_len, &p));
}
static void test_universe_too_high_rejected(void)
{
nl_e131_packet_t p;
build(64000, 100, 0, 0, 6);
TEST_ASSERT_FALSE(nl_e131_parse(pkt, pkt_len, &p));
}
int main(void)
{
UNITY_BEGIN();
@@ -197,5 +211,7 @@ int main(void)
RUN_TEST(test_property_value_count_mismatch);
RUN_TEST(test_too_short_and_too_long);
RUN_TEST(test_universe_is_read);
RUN_TEST(test_universe_zero_rejected);
RUN_TEST(test_universe_too_high_rejected);
return UNITY_END();
}