File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -94,20 +94,31 @@ PHP_FUNCTION(readlink)
94
94
PHP_FUNCTION (linkinfo )
95
95
{
96
96
char * link ;
97
- int link_len ;
97
+ char * dirname ;
98
+ int link_len , dir_len ;
98
99
struct stat sb ;
99
100
int ret ;
100
101
101
102
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s" , & link , & link_len ) == FAILURE ) {
102
103
return ;
103
104
}
104
105
106
+ dirname = estrndup (link , link_len );
107
+ dir_len = php_dirname (dirname , link_len );
108
+
109
+ if (php_check_open_basedir (dirname TSRMLS_CC )) {
110
+ efree (dirname );
111
+ RETURN_FALSE ;
112
+ }
113
+
105
114
ret = VCWD_LSTAT (link , & sb );
106
115
if (ret == -1 ) {
107
116
php_error_docref (NULL TSRMLS_CC , E_WARNING , "%s ", strerror (errno ));
117
+ efree (dirname );
108
118
RETURN_LONG (-1L );
109
119
}
110
120
121
+ efree (dirname );
111
122
RETURN_LONG ((long ) sb .st_dev );
112
123
}
113
124
/* }}} */
You can’t perform that action at this time.
0 commit comments