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:
+10
-2
@@ -47,8 +47,16 @@ bool nl_e131_parse(const uint8_t *buf, size_t len, nl_e131_packet_t *out)
|
||||
if (buf[112] & 0x80u) /* Preview-Daten duerfen laut E1.31 nicht ausgegeben werden */
|
||||
return false;
|
||||
|
||||
out->universe = be16(buf + 113);
|
||||
out->priority = buf[108];
|
||||
/* Universe must be in range 1..63999; 0 and values >63999 are reserved. */
|
||||
uint16_t universe = be16(buf + 113);
|
||||
if (universe == 0u || universe > 63999u)
|
||||
return false;
|
||||
|
||||
out->universe = universe;
|
||||
out->priority = buf[108]; /* taken as-is without range check; priority is only compared
|
||||
* relatively in later tasks, never against absolute bounds.
|
||||
* strict validation would silently drop light data from slightly
|
||||
* non-conformant senders, worse than accepting 0..255 */
|
||||
out->sequence = buf[111];
|
||||
out->terminated = (buf[112] & 0x40u) != 0u;
|
||||
out->slot_count = (uint16_t)(pvc - 1u);
|
||||
|
||||
Reference in New Issue
Block a user