Skip to content

fix race conditions and memory corruption #4

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

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

Conversation

rofl0r
Copy link

@rofl0r rofl0r commented Mar 4, 2017

No description provided.

rofl0r added 2 commits March 4, 2017 17:23
replaced the combination of calloc and strncpy with strdup.
the latter caused out of bounds writes which corrupted internal
malloc state.

fixes digination#3
the thread callback function was allocating everything on the heap
without good reason, and constructing copies of strings manually
with combinations of malloc, strncpy, strncat, etc.
i simplified all such sites to use a single snprintf into a stack
buffer, which is then passed as argument to curl.

additionally i changed the while(queue->head) loop such that the
loop is always entered, but the queue head pointer is only fetched
when the lock is held, in order to prevent races with other threads.
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.

2 participants