[tor-bugs] #28077 [Core Tor/Tor]: remove unsafe block from cstr! macro

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Oct 17 00:42:33 UTC 2018


#28077: remove unsafe block from cstr! macro
--------------------------+------------------------------------
 Reporter:  cyberpunks    |          Owner:  (none)
     Type:  defect        |         Status:  needs_revision
 Priority:  Medium        |      Milestone:
Component:  Core Tor/Tor  |        Version:  Tor: 0.3.4.1-alpha
 Severity:  Normal        |     Resolution:
 Keywords:  rust          |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by cyberpunks):

 Replying to [comment:4 teor]:
 > But I still think we don't want to hide errors by substituting the empty
 string.

 Misuse is extremely unlikely to slip in since this is only used on string
 literals. But yeah, he 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 merged in #25185. Improving on that seems like a separate
 ticket.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28077#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list