Skip to content
Snippets Groups Projects
Commit d91ad511 authored by Tobias Stoeckmann's avatar Tobias Stoeckmann Committed by Alexander Hansen Færøy
Browse files

Check tor_vasprintf for error return values.


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.

Signed-off-by: default avatarTobias Stoeckmann <tobias@stoeckmann.org>
parent 1b66668e
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment