Repository navigation
Limit source names to 63 bytes so they stay null-terminated - #76
Merged
Merged
Conversation
E1.31-2016 Section 6.2.2 requires the 64 byte Source Name field to be null-terminated, so a name can be at most 63 bytes. SacnSource accepted 64 byte names and sent them with no terminator, which this crate's own receiver then rejected with SourceNameNotNullTerminated. Packing a name of 65 bytes or more panicked. Add E131_SOURCE_NAME_MAX_LENGTH (63), check it when creating or renaming a source, and return PackInvalidData from the data and discovery framing layer pack functions when a name is too long. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzaQVQThQpmqhvLapk99Vs
These tests build the expected 64 byte source name field, padded with nulls, and passed that same padded string to SacnSource. With the 63 byte limit the padded string is rejected. Pass the name without its padding; the packets sent are byte-for-byte the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzaQVQThQpmqhvLapk99Vs
stewartadam
deleted the
claude/project-thread-njq8b9-2-source-name-63
branch
November 12, 2026 09:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
E1.31-2016 §6.2.2 requires the 64-byte Source Name field to be null-terminated, so a name can be at most 63 bytes.
SacnSource::new_*,with_*andset_nameused to accept a 64-byte name. They sent it with no terminator, and this crate's own receiver then rejected those packets withSourceNameNotNullTerminated.DataPacketFramingLayerorUniverseDiscoveryPacketFramingLayerwith a name of 65 bytes or more panicked incopy_from_slice.Changes
packet::E131_SOURCE_NAME_MAX_LENGTH(63).set_namecheck against it and returnMalformedSourceName.packfunctions returnPackInvalidDatawhen a name is too long, instead of writing an unterminated field or panicking.ipv4_tests.rs,ipv6_tests.rs), several tests used to passSacnSourcethe 64-byte, null-padded name that they build for the expected packet. They now pass the name without its padding. The packets on the wire are byte-for-byte the same.Tests
New tests in
tests/src_tests.rs:new_v4andset_name.packrejects 64-byte and 65-byte names for both data and discovery packets.cargo testpasses, and so does the full ignored IPv4 suite (cargo test --test ipv4_tests -- --ignored --test-threads=1, 47/47), run locally with the same loopback setup as the Docker job.cargo clippyreports no new warnings.