Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fixed bug #76459 windows linkinfo lacks openbasedir check
  • Loading branch information
weltling authored and smalyshev committed Jul 16, 2018
1 parent 5ac5f31 commit f151e04
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/standard/link_win32.c
Expand Up @@ -87,6 +87,7 @@ PHP_FUNCTION(readlink)
PHP_FUNCTION(linkinfo)
{
char *link;
char *dirname;
size_t link_len;
zend_stat_t sb;
int ret;
Expand All @@ -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);
}
/* }}} */
Expand Down

0 comments on commit f151e04

Please sign in to comment.