PHP  
 PHP_7_2
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for sapi/cli/tests/php_cli_server_005.phpt ('Post a file')

Script

1: <?php
2:
include "php_cli_server.inc";
3:
php_cli_server_start('var_dump($_FILES);');
4:
5: list(
$host$port) = explode(':'PHP_CLI_SERVER_ADDRESS);
6:
$port intval($port)?:80;
7:
8:
$fp fsockopen($host$port$errno$errstr0.5);
9: if (!
$fp) {
10:   die(
"connect failed");
11: }
12:
13:
$post_data = <<<POST
14:
-----------------------------114782935826962
15: Content-Disposition: form-data; name="userfile"; filename="laruence.txt"
16: Content-Type: text/plain
17:
18: I am not sure about this.
19:
20: -----------------------------114782935826962--
21:
22:
23:
POST;
24:
25:
$post_len strlen($post_data);
26:
27: if(
fwrite($fp, <<<HEADER
28:
POST / HTTP/1.1
29: Host: 
{$host}
30: Content-Type: multipart/form-data; boundary=---------------------------114782935826962
31: Content-Length: 
{$post_len}
32:
33:
34:
{$post_data}
35:
HEADER
36: )) {
37:     while (!
feof($fp)) {
38:         echo 
fgets($fp);
39:     }
40: }
41:
42:
?>
43:

Report

==10150== Jump to the invalid address stated on the next line
==10150==    at 0x4FE: ???
==10150==  Address 0x4fe is not stack'd, malloc'd or (recently) free'd
==10150== 
==10150== 
==10150== Process terminating with default action of signal 11 (SIGSEGV)
==10150==  Bad permissions for mapped region at address 0x4FE
==10150==    at 0x4FE: ???

 

Generated at Fri, 15 Dec 2017 07:20:55 +0000 (10 hours ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.