mirror of
https://github.com/php/php-src.git
synced 2026-03-31 12:42:29 +02:00
Fixed bug #76459 windows linkinfo lacks openbasedir check
This commit is contained in:
committed by
Stanislav Malyshev
parent
5ac5f313bd
commit
f151e048ed
@@ -87,6 +87,7 @@ PHP_FUNCTION(readlink)
|
||||
PHP_FUNCTION(linkinfo)
|
||||
{
|
||||
char *link;
|
||||
char *dirname;
|
||||
size_t link_len;
|
||||
zend_stat_t sb;
|
||||
int ret;
|
||||
@@ -95,12 +96,22 @@ PHP_FUNCTION(linkinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
dirname = estrndup(link, link_len);
|
||||
php_dirname(dirname, link_len);
|
||||
|
||||
if (php_check_open_basedir(dirname)) {
|
||||
efree(dirname);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret = VCWD_STAT(link, &sb);
|
||||
if (ret == -1) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
|
||||
efree(dirname);
|
||||
RETURN_LONG(Z_L(-1));
|
||||
}
|
||||
|
||||
efree(dirname);
|
||||
RETURN_LONG((zend_long) sb.st_dev);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
Reference in New Issue
Block a user