Bug #67059 [Fbk->NoF]: String pointer problem in object $_SERVER when using a proxy (buffer overflow)

From: Date: Sun, 22 Aug 2021 04:22:09 +0000
Subject: Bug #67059 [Fbk->NoF]: String pointer problem in object $_SERVER when using a proxy (buffer overflow)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235993@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67059&edit=1 ID: 67059 Updated by: php-bugs@lists.php.net Reported by: potsky at me dot com Summary: String pointer problem in object $_SERVER when using a proxy (buffer overflow) -Status: Feedback +Status: No Feedback Type: Bug Package: Apache2 related Operating System: Mac OS 10.9 PHP Version: 5.5.11 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2021-08-09 14:13:11] cmb@php.net Is this still an issue with any of the actively supported PHP versions[1]? [1] <https://www.php.net/supported-versions.php> ------------------------------------------------------------------------ [2014-04-11 12:49:23] potsky at me dot com Description: ------------ Hi, when using a proxy server between a client and the PHP server, the $_SERVER['SERVER_NAME'] is not set correctly and I think there is a serious pointer problem. Echoing $_SERVER['SERVER_NAME'] tells "potskymac.local:5757" but it tells that the string is 11 chars length. This is wrong of course. Parsing the string char by char returns the name of the internal PHP server dev.musicme instead. This problem has been teste on 5.5.9 and 5.5.11. Test script: --------------- <?php $a = $_SERVER['SERVER_NAME']; var_dump( $a ); var_dump( chr( ord( $a[0] ) ) ); var_dump( chr( ord( $a[1] ) ) ); var_dump( chr( ord( $a[2] ) ) ); var_dump( chr( ord( $a[3] ) ) ); ... var_dump( '' . $_SERVER['SERVER_NAME'] ); die(); Expected result: ---------------- On a direct connection, the result is right and is : string 'potskymac.local' (length=15) string 'p' (length=1) string 'o' (length=1) string 't' (length=1) string 's' (length=1) string 'k' (length=1) string 'y' (length=1) string 'm' (length=1) string 'a' (length=1) string 'c' (length=1) string '.' (length=1) string 'l' (length=1) string 'o' (length=1) string 'c' (length=1) string 'a' (length=1) string 'l' (length=1) It should be the same when using a proxy. Actual result: -------------- When using a proxy, the string is broken with echo, print_r, var_dump, etc... It seems there are 2 pointers for the same string. Just take a look on the cur result, the value is 11 chars length and is my proxy server dev.musicme : string 'potskymac.local:5757' (length=11) string 'd' (length=1) string 'e' (length=1) string 'v' (length=1) string '.' (length=1) string 'm' (length=1) string 'u' (length=1) string 's' (length=1) string 'i' (length=1) string 'c' (length=1) string 'm' (length=1) string 'e' (length=1) ( ! ) Notice: Uninitialized string offset: 11 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67059&edit=1

« previous php.bugs (#235993) next »