You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Null Pointer Dereference in Apple Process Iterator #129
In lines 33 and 34 of process_iterator_apple.c, malloc() is called to allocate memory for the source buffer, but the return code of malloc is never checked. If malloc() returns NULL due to a lack of available memory, the next line will then attempt to memcpy() data into a null pointer.
In the init_process_iterator() function within process_iterator_apple.c, a number of checks are performed to ensure the allocation, buffer, etc. are valid before the initialization completes. In lines 62-65 (the above code chunk), a check is performed to ensure that the malloc() call does not return NULL. If it does, fprintf() is used to print an error message. However, unlike the other checks in this function, it doesn't then return -1; - it instead continues with execution. I believe this was just a minor error where the return was forgotten, and a simple one-line change could fix it.
These are two very minor issues that only affect the Apple-specific process iterator, but I still thought they were worth raising to reduce the chance of running into null pointer issues in an out of memory scenario.
Thank you! 🙂
(Also, apologies for the edit in the issue - I accidentally ctrl+enter posted it before I was done, and add to fill in the rest after)
Activity