Cygwin: posix timers: allocate timer_tracker on system heap.
Allocating on the cygheap would copy information of the tracker into the child process. A forked child knows the timer id and could simply still access the (free'd but still valid) timer_tracker on the heap, which is dangerous and very certainly doesn't reflect POSIX semantics. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@ -414,10 +414,11 @@ timer_tracker::settime (int flags, const itimerspec *new_value,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* The timers are stored on the cygheap. */
|
||||
/* The timers are stored on the system heap in order to avoid accidental
|
||||
leaking of timer ids into the child process. */
|
||||
#define cnew(name, ...) \
|
||||
({ \
|
||||
void* ptr = (void*) ccalloc (HEAP_3_TIMER, 1, sizeof (name)); \
|
||||
void* ptr = (void*) HeapAlloc (GetProcessHeap (), 0, sizeof (name)); \
|
||||
ptr ? new (ptr) name (__VA_ARGS__) : NULL; \
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user