-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potentially incorrect normalization code in new_from_ffi #16
Comments
I don't remember the details here. While a NUL is required for This function is used by all functions that return an address, and has some tests that test it directly. But I see that the error cases are not tested, and that it likely accepts paths one too long on OpenBSD. I agree the code here is confusing, as I at first thought it was removing the last character from addresses! |
Could also hit a buffer overrun. I'd be more comfortable with code here that followed documented semantics. |
Is it code calling I want this library to be usable with all addresses that other programs might create. |
The FreeBSD man page you linked to also says
and combined with your quote it sounds like it's only for using The NetBSD man page says the same, and the DragonflyBSD man page doesn't mention I haven't found a man page for macOS, but it accepts even longer paths. |
Yes please, it would be good if the defaults were safe and the deviations from the defaults were strongly documented, linking to these man pages. |
Caught during unsafe review
uds/src/addr.rs
Lines 647 to 654 in a596894
Some platforms, including FreeBSD, require a null terminator here, which we are sometimes stripping
e.g. FreeBSD:
We do have some code on OpenBSD that talks about this but it isn't involved here, and it's only OpenBSD, not FreeBSD as well.
uds/src/addr.rs
Lines 252 to 257 in a596894
I'd recommend we'd cautiously not strip the NUL except for specific platforms where we know that that's okay.
In general the NUL invariant is also hard to follow in this follow, would be worth documenting it more.
The text was updated successfully, but these errors were encountered: