From 4af7babc372c629a525a28983bc96946e557424a Mon Sep 17 00:00:00 2001 From: Uma <uma.s@vtiger.com> Date: Thu, 18 Jun 2020 12:50:50 +0530 Subject: [PATCH] Fixes disclosing of image geo-location and privacy data --- vtlib/Vtiger/Functions.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index ce63474f1..c726b8184 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -662,26 +662,26 @@ class Vtiger_Functions { //metadata check $shortTagSupported = ini_get('short_open_tag') ? true : false; if ($saveimage == 'true') { - $tmpFileName = $file_details['tmp_name']; - if($file_details['type'] == 'image/jpeg' || $file_details['type'] == 'image/tiff') { - $exifdata = @exif_read_data($file_details['tmp_name']); - if($exifdata && !self::validateImageMetadata($exifdata, $shortTagSupported)) { - $saveimage = 'false'; - } - //131225968::remove sensitive information(like,GPS or camera information) from the image - if(($saveimage == 'true' ) && ($file_details['type'] == 'image/jpeg' ) && extension_loaded('gd') && function_exists('gd_info')) { - $img = imagecreatefromjpeg($tmpFileName); - imagejpeg ($img, $tmpFileName); - } - } + $tmpFileName = $file_details['tmp_name']; + if($file_details['type'] == 'image/jpeg' || $file_details['type'] == 'image/tiff') { + $exifdata = @exif_read_data($file_details['tmp_name']); + if($exifdata && !self::validateImageMetadata($exifdata, $shortTagSupported)) { + $saveimage = 'false'; + } + //remove sensitive information(like,GPS or camera information) from the image + if(($saveimage == 'true' ) && ($file_details['type'] == 'image/jpeg' ) && extension_loaded('gd') && function_exists('gd_info')) { + $img = imagecreatefromjpeg($tmpFileName); + imagejpeg ($img, $tmpFileName); + } + } } // Check for php code injection if ($saveimage == 'true') { - $imageContents = file_get_contents($file_details['tmp_name']); - if (stripos($imageContents, $shortTagSupported ? "<?" : "<?php") !== false) { // suspicious dynamic content. - $saveimage = 'false'; - } + $imageContents = file_get_contents($file_details['tmp_name']); + if (stripos($imageContents, $shortTagSupported ? "<?" : "<?php") !== false) { // suspicious dynamic content. + $saveimage = 'false'; + } } return $saveimage; } -- GitLab