Skip to content

Commit b08b7fe

Browse files
committed
Merge branch 'PHP-5.3' into PHP-5.4
2 parents cff89ce + 9007787 commit b08b7fe

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ PHP NEWS
8888
. Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL
8989
bytes). (Nikita Popov)
9090

91+
- Readline:
92+
. Add open_basedir checks to readline_write_history and readline_read_history.
93+
(Rasmus, reported by Mateusz Goik)
94+
9195
- Reflection:
9296
. Fixed bug #60968 (Late static binding doesn't work with
9397
ReflectionMethod::invokeArgs()). (Laruence)

ext/standard/link.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,31 @@ PHP_FUNCTION(readlink)
8585
PHP_FUNCTION(linkinfo)
8686
{
8787
char *link;
88-
int link_len;
88+
char *dirname;
89+
int link_len, dir_len;
8990
struct stat sb;
9091
int ret;
9192

9293
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) {
9394
return;
9495
}
9596

97+
dirname = estrndup(link, link_len);
98+
dir_len = php_dirname(dirname, link_len);
99+
100+
if (php_check_open_basedir(dirname TSRMLS_CC)) {
101+
efree(dirname);
102+
RETURN_FALSE;
103+
}
104+
96105
ret = VCWD_LSTAT(link, &sb);
97106
if (ret == -1) {
98107
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
108+
efree(dirname);
99109
RETURN_LONG(-1L);
100110
}
101111

112+
efree(dirname);
102113
RETURN_LONG((long) sb.st_dev);
103114
}
104115
/* }}} */

0 commit comments

Comments
 (0)