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

前端 未结 5 1056
情书的邮戳
情书的邮戳 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:26

    A buffer overrun may clobber a previously saved version of the frame pointer on the stack. When the function returns, this corrupt version is loaded into the frame pointer register, causing the behavior you describe.

    Wikipedia's page contains a figure and definitions.

提交回复
热议问题