Parsing the Null character problem in PHP security issues_PHP tutorial

WBOY
Release: 2016-07-21 15:04:35
Original
837 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template