[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #28079 [Core Tor/Tor]: Stop returning the empty string when the cstr! macro fails
#28079: Stop returning the empty string when the cstr! macro fails
------------------------------+------------------------------
Reporter: teor | Owner: (none)
Type: enhancement | Status: new
Priority: Medium | Milestone: Tor: unspecified
Component: Core Tor/Tor | Version:
Severity: Normal | Keywords: rust
Actual Points: | Parent ID:
Points: | Reviewer:
Sponsor: |
------------------------------+------------------------------
Split off #28077:
> > from_bytes_with_nul returns an error if there is more than one nul
byte in the string.
> > ...
> > Returning an empty string could be a source of subtle bugs.
> Misuse is extremely unlikely to slip in since this is only used on
string literals. But yeah, the ideal solution would be statically
asserting at compile-time that the passed literal has no NUL bytes in it,
so the only one is the byte being appended.
>
> But defaulting to an empty string(in a case that is basically impossible
to get) is the intentional documented behavior of the macro ever since it
was first
[https://gitweb.torproject.org/tor.git/commit/?h=tor-0.3.4.1-alpha&id=bda1dfb9e0a863ae1ec1230c23ed74837be01a35
merged] in #25185. Improving on that seems like a separate ticket.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28079>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs