<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 內存,第 3 部分:粉碎棧示例 > 原文:<https://github.com/angrave/SystemProgramming/wiki/Memory%2C-Part-3%3A-Smashing-the-Stack-Example> 每個線程使用棧內存。棧“向下增長” - 如果函數調用另一個函數,則棧擴展到較小的內存地址。棧內存包括非靜態自動(臨時)變量,參數值和返回地址。如果緩沖區太小某些數據(例如來自用戶的輸入值),那么很可能會覆蓋其他棧變量甚至返回地址。棧內容的精確布局和自動變量的順序取決于體系結構和編譯器。然而,通過一些調查工作,我們可以學習如何故意粉碎特定架構的棧。 下面的示例演示了返回地址如何存儲在棧中。對于特定的 32 位架構 [Live Linux Machine](http://cs-education.github.io/sys/) ,我們確定返回地址存儲在自動變量地址上方兩個指針(8 個字節)的地址處。代碼故意更改棧值,以便在輸入函數返回時,而不是繼續在 main 方法內部,它會跳轉到 exploit 函數。 ```c // Overwrites the return address on the following machine: // http://cs-education.github.io/sys/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> void breakout() { puts("Welcome. Have a shell..."); system("/bin/sh"); } void input() { void *p; printf("Address of stack variable: %p\n", &p); printf("Something that looks like a return address on stack: %p\n", *((&p)+2)); // Let's change it to point to the start of our sneaky function. *((&p)+2) = breakout; } int main() { printf("main() code starts at %p\n",main); input(); while (1) { puts("Hello"); sleep(1); } return 0; } ``` [有很多](https://en.wikipedia.org/wiki/Stack_buffer_overflow)計算機傾向于解決這個問題。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看