Using errors in programs, intruder can gain privileges at which it (program) was run.
Existence of errors contained in programs gives possibility of accessing data or process memory.
We'll explore how this kind of abuse can be exploited.
'buffer overlov', in this case buffers are on heap (in heap segment).
'file name overwrite to access private data'.
(perhaps encrypted) system passwords are in /etc/shadow.
root privileges (can check for +s permissions flag) are required to read from /etc/shadow.
unneccessary lines (such as debug printf) are danger to leave, for they give out information about hacker.
for more details please see Literature: , , perhaps more.
see also, if You wish or need ... : 'Heap Overflow' Hacking Attack.