<pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
    <pre id="vvttv"></pre>

      <p id="vvttv"></p>

          <p id="vvttv"></p>

                <p id="vvttv"></p>

                <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                  <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                    <p id="vvttv"></p>

                    Missing Check against Null

                    ABSTRACT

                    程序會間接引用一個空指針,因為它不對有可能返回 Null 的函數返回值進行檢查。

                    EXPLANATION

                    幾乎每一個對軟件系統的嚴重攻擊都是從違反程序員的假設開始的。攻擊后,程序員的假設看起來既脆弱又拙劣,但攻擊前,許多程序員會在午休時間為自己的種種假設做很好的辯護。

                    在代碼中很容易發現的兩個可疑的假設是:一是這個函數調用不可能出錯;二是即使出錯了,也不會對系統造成什么重要影響。當程序員忽略函數返回值時,就暗示著自己是基于上述任一假設來執行操作。



                    例 1:以下代碼在調用成員函數 compareTo() 之前,不會檢查 getParameter() 返回的字符串是否為 Null,因此可能會造成 null dereference。


                    String itemName = request.getParameter(ITEM_NAME);
                    if (itemName.compareTo(IMPORTANT_ITEM)) {
                    ...
                    }
                    ...


                    例 2:。以下代碼顯示了這樣一個例子,一個系統屬性被設置為了 Null,隨后間接引用它的程序員錯誤地認為該屬性值是已定義的。


                    System.clearProperty("os.name");
                    ...
                    String os = System.getProperty("os.name");
                    if (os.equalsIgnoreCase("Windows 95") )
                    System.out.println("Not supported");


                    對于這種編碼錯誤的一貫辯解是:

                    “我知道請求值總是存在的,因為如果值不存在,程序就不能執行所需的操作,那么無論我處理這個錯誤,還是只是讓程序自行崩潰而間接引用 Null 值,都沒有關系。

                    但是,攻擊者對于發現程序中的意外情況十分在行,特別是發生異常時。

                    REFERENCES

                    [1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A9 Application Denial of Service

                    [2] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3120 CAT II, APP6080 CAT II

                    [3] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3120 CAT II, APP6080 CAT II

                    [4] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 253, CWE ID 690

                    [5] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.9


                    Copyright 2013 Fortify Software - All rights reserved.
                    (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
                    desc.controlflow.java.missing_check_against_null

                      <pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
                      <pre id="vvttv"></pre>

                        <p id="vvttv"></p>

                            <p id="vvttv"></p>

                                  <p id="vvttv"></p>

                                  <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                                    <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                                      <p id="vvttv"></p>

                                      这里只有精品视频