Why would buffer overruns cause segmentation faults when accessing an integer?

前端 未结 5 1057
情书的邮戳
情书的邮戳 2021-01-19 09:39

During a call to function B() from function A(), B() allocates a 100-char array and fills it several times, including once with a 101-character string and once with a 110 ch

5条回答
  •  太阳男子
    2021-01-19 10:28

    The most likely explanation from you description is that the overrun in B corrupts the saved frame pointer on the stack for A. So after B returns, A has garbage in its frame pointer and crashes when it tries to access a local variable.

提交回复
热议问题