본문 바로가기

옥탑방주인/-D

스택 오버플로우(stack overflow)와 버퍼 오버플로우(buffer overflow)의 차이점이 뭘까??

Q : 

What is the difference between a stack overflow and buffer overflow?



A :

Stack overflow refers specifically to the case when the execution stack grows beyond the memory that is reserved for it. For example, if you call a function which recursively calls itself without termination, you will cause a stack overflow as each function call creates a new stack frame and the stack will eventually consume more memory than 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). For example, if you write past the end of an array allocated from the heap, you've caused a buffer overflow.




출처 : https://stackoverflow.com/questions/1120575/what-is-the-difference-between-a-stack-overflow-and-buffer-overflow