空指標檢查的安全影響與分析
A Measurement Study on the Security Impacts of Null Pointer Checks
摘要
指標在 C/C++ 語言中扮演著非常重要的角色,但也成為許多人撰寫程式時的惡夢。為了確保程式執行時不會發生任何的空指標解引用(null pointer dereference)錯誤導致程式終止,大多數的人會進行空指標檢查(null pointer check,如~"if (ptr != NULL)")來確保錯誤不會發生。但對於撰寫函式庫的程式設計師來說,他們是否也要對外來的指標參數進行檢查呢?還是交由函式庫使用者端(使用該函式庫的可執行程式)來檢查?在沒有一個統一標準的情況下,很容易會發生同一指標重複檢查,甚至是更嚴重的缺少檢查的現象,最終導致漏洞產生。因此我們想針對空指標檢查的使用時機與其帶來的安全性影響進行分析,對象包含開放原始碼函式庫以及軟體。函式庫使用者則可以藉由我們的分析結果,來確保沒有潛在的空指標檢查缺失,提昇程式的安全性。
Pointer plays a very important role in C/C++, but it has also become a nightmare for many programmers. In order to ensure that program will not be terminated because of any null pointer dereference error, most people will perform a null pointer check (such as "if (ptr != NULL)") to make sure the error never happen. But for programmers who write libraries, should they also do any null pointer checks on external pointer parameters? Or should they leave the responsibility to library users, the developers who use the library? In the absence of a unified standard, it is easy to check the same pointer redundantly, or even miss the necessary check and eventually cause serious vulnerability.
% google translated below
Therefore, we want to analyze the timing of the use of the empty index check and the security impact it brings. The objects include open source code libraries and software. Library users can use our analysis results to ensure that there is no potential null indicator check missing and improve the security of the program.
% google translated below
Therefore, we want to analyze the timing of the use of the empty index check and the security impact it brings. The objects include open source code libraries and software. Library users can use our analysis results to ensure that there is no potential null indicator check missing and improve the security of the program.