Question: what is the difference between a stack-based and a heap-based buffer overflow?
Answer: Stack overflow refers specifically to the case when the execution stack grows beyond the memory that is reserved for it. ... Buffer overflow refers to any case in which a program writes beyond the end of the memory allocated for any buffer (including on the heap, not just on the stack).