# HG changeset patch # User Dan # Date 1226201563 18000 # Node ID e2762777b170ce63a584f70d64c48365364e3891 # Parent f82da241eaf86be5b74f4abb96e7ba7184b9f47a Fixed attempt at gzip compression after headers sent; hopefully safely escape args to scale_image() instead of erroring out diff -r f82da241eaf8 -r e2762777b170 includes/functions.php --- a/includes/functions.php Sat Nov 08 22:31:58 2008 -0500 +++ b/includes/functions.php Sat Nov 08 22:32:43 2008 -0500 @@ -3148,7 +3148,7 @@ // Compress buffered output if required and send to browser // Sorry, doesn't work in IE. What else is new? // - if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) + if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() ) { $gzip_contents = ob_get_contents(); ob_end_clean(); @@ -3752,8 +3752,8 @@ if ( !file_exists($in_file) ) return false; - if ( preg_match('/["\'\/\\\\]/', $in_file) || preg_match('/["\'\/\\\\]/', $out_file) ) - die('SECURITY: scale_image(): infile or outfile path is screwy'); + $in_file = escapeshellarg($in_file); + $out_file = escapeshellarg($out_file); if ( file_exists($out_file) && !$unlink ) return false;