diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-11-16 20:29:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 20:29:57 +0100 |
commit | ec84b5c4ee4f9734861926255639bdb09f9f6306 (patch) | |
tree | f74653b9d05bba1e53f54685ca6817c971d932d2 /lib | |
parent | 4fe9738857877bf7c3e07f31a1849f0b293513a6 (diff) | |
parent | febc24db137f585de2b6871ac64e474b07142f65 (diff) | |
download | nextcloud-server-ec84b5c4ee4f9734861926255639bdb09f9f6306.tar.gz nextcloud-server-ec84b5c4ee4f9734861926255639bdb09f9f6306.zip |
Merge pull request #41539 from nextcloud/backport/37959/stable27
[stable27] Check for open_basedir before reading /proc
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/Generator.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index c83cdb96e27..f1a43ee9128 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -263,9 +263,15 @@ class Generator { */ public static function getHardwareConcurrency(): int { static $width; + if (!isset($width)) { - if (is_file("/proc/cpuinfo")) { - $width = substr_count(file_get_contents("/proc/cpuinfo"), "processor"); + if (function_exists('ini_get')) { + $openBasedir = ini_get('open_basedir'); + if (empty($openBasedir) || strpos($openBasedir, '/proc/cpuinfo') !== false) { + $width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0; + } else { + $width = 0; + } } else { $width = 0; } |