Fix buffer-overflow in open_basedir()

This commit is contained in:
Ilija Tovilo 2023-03-26 10:28:27 +02:00
parent 2b9d2bcee7
commit a7f91e37de
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
2 changed files with 2 additions and 1 deletions

View file

@ -10,6 +10,7 @@ $tmpDir = $originalDir . '/gh10469_tmp';
chdir($tmpDir);
ini_set('open_basedir', ini_get('open_basedir') . ':./..');
ini_set('open_basedir', ini_get('open_basedir') . ':./../');
ini_set('open_basedir', ini_get('open_basedir') . ':/a/');
chdir($originalDir);
var_dump(ini_get('open_basedir'));

View file

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