Permalink
Browse files

Fixed bug #76459 windows linkinfo lacks openbasedir check

  • Loading branch information...
weltling authored and smalyshev committed Jul 3, 2018
1 parent 5ac5f31 commit f151e048ed27f6f4eef729f3310d053ab5da71d4
Showing with 11 additions and 0 deletions.
  1. +11 −0 ext/standard/link_win32.c
View
@@ -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);
}
/* }}} */

0 comments on commit f151e04

Please sign in to comment.