You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SockAddr::unix accepts pathname bytes containing NUL, which operating systems can truncate and the standard library rejects. Reject those pathnames with InvalidInput in both constructor backends. Preserve the existing leading-NUL address behavior, including Linux abstract names containing additional zero bytes.
Retain a fallible as_unix conversion for addresses initialized from raw storage: a full-size, null-terminated sockaddr_un can still include padding NULs in the pathname exposed by as_pathname. The new raw-storage fixture covers that conversion boundary.
Validation: constructor rejection fails on the previous PR head and passes after the change; ordinary/non-UTF-8 paths, empty/unnamed addresses and abstract names are preserved. Default and all-feature suites pass in debug and release (11 unit tests; 47 default or 82 all-feature integration tests; 7 or 8 doc tests). Formatting, all-target/all-feature Clippy with warnings denied, docs and all-target/all-feature Windows MSVC and FreeBSD compile checks pass. Runtime tests were run on Linux; the Windows/FreeBSD checks were compilation only.
I don't think is the right approach, we should look into disallowing the creation of address with internal null bytes. Most OS, being C based, don't deal well with internal null bytes.
Updated the existing branch to reject NUL bytes in pathname addresses in both constructor backends. Leading-NUL addresses retain their existing behavior, including interior zeros in Linux abstract names.
I kept the fallible as_unix conversion because raw initializers can still provide a full-size null-terminated sockaddr_un whose padding is included by as_pathname; a separate raw-storage regression covers that case. The constructor regression fails on the previous PR head and passes with this change. Final test and cross-compilation results are recorded in the updated description.
This branch has not been deployed
No deployments
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
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.
SockAddr::unixaccepts pathname bytes containing NUL, which operating systems can truncate and the standard library rejects. Reject those pathnames withInvalidInputin both constructor backends. Preserve the existing leading-NUL address behavior, including Linux abstract names containing additional zero bytes.Retain a fallible
as_unixconversion for addresses initialized from raw storage: a full-size, null-terminatedsockaddr_uncan still include padding NULs in the pathname exposed byas_pathname. The new raw-storage fixture covers that conversion boundary.Fixes #681.
Validation: constructor rejection fails on the previous PR head and passes after the change; ordinary/non-UTF-8 paths, empty/unnamed addresses and abstract names are preserved. Default and all-feature suites pass in debug and release (11 unit tests; 47 default or 82 all-feature integration tests; 7 or 8 doc tests). Formatting, all-target/all-feature Clippy with warnings denied, docs and all-target/all-feature Windows MSVC and FreeBSD compile checks pass. Runtime tests were run on Linux; the Windows/FreeBSD checks were compilation only.