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

Forbid access to parent folders in SVG images path. #780

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.TXT
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
6.8.1 (2025-01-26)
- Check relative paths on SVG images.

6.8.0 (2024-12-23)
- Requires PHP 7.1+ and curl extension.
- Escape error message.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

2002-2024 Nicola Asuni - Tecnick.com LTD
2002-2025 Nicola Asuni - Tecnick.com LTD

**********************************************************************
**********************************************************************
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

* **category** Library
* **author** Nicola Asuni <info@tecnick.com>
* **copyright** 2002-2024 Nicola Asuni - Tecnick.com LTD
* **copyright** 2002-2025 Nicola Asuni - Tecnick.com LTD
* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* **link** http://www.tcpdf.org
* **source** https://github.com/tecnickcom/TCPDF
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.8.0
6.8.1
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"barcodes"
],
"homepage": "http://www.tcpdf.org/",
"version": "6.8.0",
"version": "6.8.1",
"license": "LGPL-3.0-or-later",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion include/tcpdf_fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2008-2024 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2008-2025 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
Expand Down
4 changes: 2 additions & 2 deletions include/tcpdf_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2024 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2002-2025 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
Expand Down Expand Up @@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.8.0';
private static $tcpdf_version = '6.8.1';

/**
* String alias for total number of pages.
Expand Down
12 changes: 8 additions & 4 deletions tcpdf.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.8.0
// Version : 6.8.1
// Begin : 2002-08-03
// Last Update : 2024-12-23
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2024 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2002-2025 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
Expand Down Expand Up @@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.8.0
* @version 6.8.1
*/

// TCPDF configuration
Expand All @@ -128,7 +128,7 @@
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.8.0
* @version 6.8.1
* @author Nicola Asuni - info@tecnick.com
* @IgnoreAnnotation("protected")
* @IgnoreAnnotation("public")
Expand Down Expand Up @@ -24467,6 +24467,10 @@ protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array()
$img = '@'.base64_decode(substr($img, strlen($m[0])));
} else {
// fix image path
if (strpos($img, '../') !== false) {
// accessing parent folders is not allowed
break;
}
if (!TCPDF_STATIC::empty_string($this->svgdir) AND (($img[0] == '.') OR (basename($img) == $img))) {
// replace relative path with full server path
$img = $this->svgdir.'/'.$img;
Expand Down
Loading