Home  >  Article  >  Backend Development  >  Parsing the Null character problem in PHP security issues_PHP tutorial

Parsing the Null character problem in PHP security issues_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:04:35795browse

Because PHP's file system operations are based on C language functions, it may handle Null characters in ways you don't expect. The Null character is used to identify the end of a string in the C language. A complete string is from the beginning until the Null character is encountered. The following code demonstrates a similar attack:
Example #1 Code that will be attacked by the Null character problem

Copy the code The code is as follows :

$file = $_GET['file']; // "../../etc/passwd



http://www.bkjia.com/PHPjc/327765.html

www.bkjia.com
true

http: //www.bkjia.com/PHPjc/327765.html
TechArticle
Since PHP’s file system operations are based on C language functions, it may operate in ways you don’t expect. Handle Null characters. The Null character is used in C language to identify the end of a string...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn