From 0344b168276f80189e2254c75a762aff5b517b6b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 06:32:57 -0400
Subject: [PATCH] Fix priority icon(s) position
---
program/include/rcmail_output_html.php | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 26bb91d..8dda8c3 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -224,6 +224,17 @@
*/
public function set_skin($skin)
{
+ // Sanity check to prevent from path traversal vulnerability (#1490620)
+ if (strpos($skin, '/') !== false || strpos($skin, "\\") !== false) {
+ rcube::raise_error(array(
+ 'file' => __FILE__,
+ 'line' => __LINE__,
+ 'message' => 'Invalid skin name'
+ ), true, false);
+
+ return false;
+ }
+
$valid = false;
$path = RCUBE_INSTALL_PATH . 'skins/';
@@ -262,11 +273,14 @@
$meta = @file_get_contents(RCUBE_INSTALL_PATH . $skin_path . '/meta.json');
$meta = @json_decode($meta, true);
- $meta['path'] = $skin_path;
- $skin_id = end(explode('/', $skin_path));
+ $meta['path'] = $skin_path;
+ $path_elements = explode('/', $skin_path);
+ $skin_id = end($path_elements);
+
if (!$meta['name']) {
$meta['name'] = $skin_id;
}
+
$this->skins[$skin_id] = $meta;
if ($meta['extends']) {
@@ -388,7 +402,7 @@
if ($override || !$this->message) {
if ($this->app->text_exists($message)) {
if (!empty($vars))
- $vars = array_map('Q', $vars);
+ $vars = array_map(array('rcube','Q'), $vars);
$msgtext = $this->app->gettext(array('name' => $message, 'vars' => $vars));
}
else
@@ -502,10 +516,10 @@
// write all javascript commands
$this->add_script($commands, 'head_top');
- // send clickjacking protection headers
+ // allow (legal) iframe content to be loaded
$iframe = $this->framed || $this->env['framed'];
- if (!headers_sent() && ($xframe = $this->app->config->get('x_frame_options', 'sameorigin'))) {
- header('X-Frame-Options: ' . ($iframe && $xframe == 'deny' ? 'sameorigin' : $xframe));
+ if (!headers_sent() && $iframe && $this->app->config->get('x_frame_options', 'sameorigin') === 'deny') {
+ header('X-Frame-Options: sameorigin', true);
}
// call super method
@@ -956,7 +970,7 @@
"rcube_utils::get_input_value('\\1', rcube_utils::INPUT_GPC)",
"\$_COOKIE['\\1']",
"\$browser->{'\\1'}",
- $this->template_name,
+ "'" . $this->template_name . "'",
),
$expression
);
--
Gitblit v1.9.1