Skip to content
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

Static date header #265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

YggdrasiI
Copy link
Contributor

This is a proposal to fix #254 .
It just converts the storage for the date header into a fixed array. So, valgrind does not complain about the non-freed array at program end.
The change doesn't release us from using the locking around reading/writing the date_header.

Reason for the change: The latest allocation of 'onion_response_last_date_header'
in response.c will never free'd.

Solution: Change 'onion_response_last_date_header' into static array
and change strdup() by memcpy() call.
Moreover, only one of the competing threads 'with a new header string'
will overwrites 'onion_response_last_date_header'.
This string will hold a localized timestamp, but 200 seems
too pessimistic?!
(Multi-byte characters made it hard to estimate the lowest bound,
but for the current strftime pattern all values > 64 seems big enough. )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libonion leaks 31 bytes in all programs
1 participant