Skip to content

Commit a7f91e3

Browse files
committed
Fix buffer-overflow in open_basedir()
1 parent 2b9d2bc commit a7f91e3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Zend/tests/gh10469.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ $tmpDir = $originalDir . '/gh10469_tmp';
1010
chdir($tmpDir);
1111
ini_set('open_basedir', ini_get('open_basedir') . ':./..');
1212
ini_set('open_basedir', ini_get('open_basedir') . ':./../');
13+
ini_set('open_basedir', ini_get('open_basedir') . ':/a/');
1314

1415
chdir($originalDir);
1516
var_dump(ini_get('open_basedir'));

main/fopen_wrappers.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
103103
}
104104
/* Don't allow paths with a parent dir component (..) to be set at runtime */
105105
char *substr_pos = ptr;
106-
while (true) {
106+
while (*substr_pos) {
107107
// Check if we have a .. path component
108108
if (substr_pos[0] == '.'
109109
&& substr_pos[1] == '.'

0 commit comments

Comments
 (0)