mirror of
https://github.com/php/php-src.git
synced 2026-04-13 11:02:55 +02:00
Fixed bug #76459 windows linkinfo lacks openbasedir check
This commit is contained in:
committed by
Stanislav Malyshev
parent
3462efa386
commit
289cb0f77c
@@ -87,7 +87,8 @@ PHP_FUNCTION(readlink)
|
||||
PHP_FUNCTION(linkinfo)
|
||||
{
|
||||
char *link;
|
||||
int link_len;
|
||||
char *dirname;
|
||||
int link_len, dir_len;
|
||||
struct stat sb;
|
||||
int ret;
|
||||
|
||||
@@ -95,12 +96,22 @@ PHP_FUNCTION(linkinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
dirname = estrndup(link, link_len);
|
||||
dir_len = php_dirname(dirname, link_len);
|
||||
|
||||
if (php_check_open_basedir(dirname TSRMLS_CC)) {
|
||||
efree(dirname);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret = VCWD_STAT(link, &sb);
|
||||
if (ret == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
|
||||
efree(dirname);
|
||||
RETURN_LONG(-1L);
|
||||
}
|
||||
|
||||
efree(dirname);
|
||||
RETURN_LONG((long) sb.st_dev);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
Reference in New Issue
Block a user