Skip to content

Comments

fix race conditions and memory corruption#4

Open
rofl0r wants to merge 2 commits intodigination:masterfrom
rofl0r:master
Open

fix race conditions and memory corruption#4
rofl0r wants to merge 2 commits intodigination:masterfrom
rofl0r:master

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