[tor-bugs] #31147 [Core Tor/Tor]: Check tor_vasprintf for error return values.
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Jul 12 18:11:57 UTC 2019
#31147: Check tor_vasprintf for error return values.
--------------------------+------------------------------
Reporter: paldium | Owner: (none)
Type: enhancement | Status: new
Priority: Low | Component: Core Tor/Tor
Version: Tor: 0.4.0.5 | Severity: Normal
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
--------------------------+------------------------------
In case of error, a negative value will be returned or NULL written into
first supplied argument.
This patch uses both cases to comply with style in the specific files.
A tor_vasprintf error in process_vprintf would lead to a NULL dereference
later on in buf_add, because the return value -1 casted to size_t would
pass an assertion check inside of buf_add.
On the other hand, common systems will fail on such an operation, so it
is not a huge difference to a simple assertion. Yet it is better to
properly fail instead of relying on such behaviour on all systems.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/31147>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list