com php-src: Fixed bug #76459 windows linkinfo lacks openbasedir check: ext/standard/link_win32.c
| From: | Joe Watkins | Date: | Wed, 18 Jul 2018 09:53:01 +0000 |
| Subject: | com php-src: Fixed bug #76459 windows linkinfo lacks openbasedir check: ext/standard/link_win32.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102596@lists.php.net to get a copy of this message | ||
Commit: 2fa74ad7c4f7f716183860e81489490b83277ccc
Author: Anatol Belski <ab@php.net> Tue, 3 Jul 2018 14:04:22 +0200
Committer: Joe Watkins <krakjoe@php.net> Wed, 18 Jul 2018 11:53:01 +0200
Parents: e29c24e381445159e7ccc90501bc67bac956348b
Branches: PHP-7.1.20
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2fa74ad7c4f7f716183860e81489490b83277ccc
Log:
Fixed bug #76459 windows linkinfo lacks openbasedir check
Bugs:
https://bugs.php.net/76459
Changed paths:
M ext/standard/link_win32.c
Diff:
diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c
index 898928b..b46dee6 100644
--- a/ext/standard/link_win32.c
+++ b/ext/standard/link_win32.c
@@ -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);
}
/* }}} */