summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/link_win32.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c
index 6be7b5f63a..059201c6b2 100644
--- a/ext/standard/link_win32.c
+++ b/ext/standard/link_win32.c
@@ -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);
}
/* }}} */