Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle symlinked directories #13

Merged
merged 2 commits into from Oct 11, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/stats/namespace.php
Expand Up @@ -492,7 +492,7 @@ function display_network_storage() {
}

function calculate_network_storage() {
$path = wp_upload_dir()['basedir'];
$path = realpath( wp_upload_dir()['basedir'] );
$storage = format_bytes( rtrim( str_replace( $path, '', `du -b -s $path` ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$path can theoretically be false.

$path can theoretically be exploited (the command line version of https://xkcd.com/327/) it should be wrapped in escapeshellarg()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backticks = shell_exec, (aka exec, aka system, ...) I would prefer a function here so I don't have to squint as much.

return $storage;
}
Expand Down