Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
F
foodsharing
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
243
Issues
243
List
Boards
Labels
Service Desk
Milestones
Merge Requests
47
Merge Requests
47
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
foodsharing-dev
foodsharing
Commits
de385cab
Commit
de385cab
authored
Feb 19, 2019
by
chandi
Committed by
Matthias Larisch
Feb 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
escape dot's in user input
parent
eb7e1435
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
4 deletions
+30
-4
src/Lib/Func.php
src/Lib/Func.php
+7
-0
src/Lib/Xhr/XhrMethods.php
src/Lib/Xhr/XhrMethods.php
+13
-4
src/Modules/Email/EmailControl.php
src/Modules/Email/EmailControl.php
+6
-0
src/Modules/Login/LoginXhr.php
src/Modules/Login/LoginXhr.php
+4
-0
No files found.
src/Lib/Func.php
View file @
de385cab
...
...
@@ -498,6 +498,10 @@ Verantwortlich für den Inhalt nach § 55 Abs. 2 RStV:<br />
public
function
img
(
$file
=
false
,
$size
=
'mini'
,
$format
=
'q'
,
$altimg
=
false
)
{
// prevent path traversal
$file
=
preg_replace
(
'/%/'
,
''
,
$file
);
$file
=
preg_replace
(
'/\.+/'
,
'.'
,
$file
);
if
(
$file
===
false
)
{
$file
=
$_SESSION
[
'client'
][
'photo'
];
}
...
...
@@ -1005,6 +1009,9 @@ Verantwortlich für den Inhalt nach § 55 Abs. 2 RStV:<br />
private
function
resizeImg
(
$img
,
$width
,
$format
)
{
// prevent path traversal
$img
=
preg_replace
(
'/%/'
,
''
,
$img
);
$img
=
preg_replace
(
'/\.+/'
,
'.'
,
$img
);
if
(
file_exists
(
$img
))
{
$opt
=
'auto'
;
if
(
$format
==
'q'
)
{
...
...
src/Lib/Xhr/XhrMethods.php
View file @
de385cab
...
...
@@ -594,8 +594,6 @@ class XhrMethods
public
function
xhr_pictureCrop
(
$data
)
{
$data
[
'img'
];
$data
[
'id'
];
/*
* [ratio-val] => [{"x":37,"y":87,"w":500,"h":281},{"x":64,"y":0,"w":450,"h":450}]
[resize] => [250,528]
...
...
@@ -604,6 +602,10 @@ class XhrMethods
$ratio
=
json_decode
(
$_POST
[
'ratio-val'
],
true
);
$resize
=
json_decode
(
$_POST
[
'resize'
]);
// prevent path traversal
$data
[
'id'
]
=
preg_replace
(
'/[^a-z0-9\-_]/'
,
''
,
$data
[
'id'
]);
$data
[
'img'
]
=
preg_replace
(
'/[^a-z0-9\-_\.]/'
,
''
,
$data
[
'img'
]);
if
(
is_array
(
$ratio
)
&&
is_array
(
$resize
))
{
foreach
(
$ratio
as
$i
=>
$r
)
{
$this
->
cropImg
(
ROOT_DIR
.
'images/'
.
$data
[
'id'
],
$data
[
'img'
],
$i
,
$r
[
'x'
],
$r
[
'y'
],
$r
[
'w'
],
$r
[
'h'
]);
...
...
@@ -671,12 +673,14 @@ class XhrMethods
private
function
pictureResize
(
$data
)
{
$id
=
$data
[
'id'
];
$img
=
$data
[
'img'
];
$id
=
preg_replace
(
'/[^a-z0-9\-_]/'
,
''
,
$data
[
'id'
]);
$img
=
preg_replace
(
'/[^a-z0-9\-_\.]/'
,
''
,
$data
[
'img'
]);
$resize
=
json_decode
(
$data
[
'resize'
],
true
);
if
(
is_array
(
$resize
))
{
foreach
(
$resize
as
$r
)
{
$r
=
(
int
)
$r
;
copy
(
ROOT_DIR
.
'images/'
.
$id
.
'/'
.
$img
,
ROOT_DIR
.
'images/'
.
$id
.
'/'
.
$r
.
'_'
.
$img
);
$image
=
new
fImage
(
ROOT_DIR
.
'images/'
.
$id
.
'/'
.
$r
.
'_'
.
$img
);
$image
->
resize
(
$r
,
0
);
...
...
@@ -847,6 +851,10 @@ class XhrMethods
if
(
isset
(
$_FILES
[
'uploadpic'
]))
{
$error
=
0
;
$datei
=
$_FILES
[
'uploadpic'
][
'tmp_name'
];
// prevent path traversal
$datei
=
preg_replace
(
'/%/'
,
''
,
$datei
);
$datei
=
preg_replace
(
'/\.+/'
,
'.'
,
$datei
);
$datein
=
$_FILES
[
'uploadpic'
][
'name'
];
$datein
=
strtolower
(
$datein
);
$datein
=
str_replace
(
'.jpeg'
,
'.jpg'
,
$datein
);
...
...
@@ -869,6 +877,7 @@ class XhrMethods
}
}
elseif
(
isset
(
$_POST
[
'action'
])
&&
$_POST
[
'action'
]
==
'crop'
)
{
$file
=
str_replace
(
'/'
,
''
,
$_POST
[
'file'
]);
if
(
$img
=
$this
->
cropImage
(
$file
,
$_POST
[
'x'
],
$_POST
[
'y'
],
$_POST
[
'w'
],
$_POST
[
'h'
]))
{
$id
=
strip_tags
(
$_POST
[
'pic_id'
]);
...
...
src/Modules/Email/EmailControl.php
View file @
de385cab
...
...
@@ -354,6 +354,12 @@ class EmailControl extends Control
$hheight
=
$tag
->
getAttribute
(
'height'
);
$iname
=
$tag
->
getAttribute
(
'name'
);
// prevent path traversal attacks
$src
=
preg_replace
(
'/%/'
,
''
,
$src
);
$src
=
preg_replace
(
'/\.+/'
,
'.'
,
$src
);
$iname
=
preg_replace
(
'/%/'
,
''
,
$iname
);
$iname
=
preg_replace
(
'/\.+/'
,
'.'
,
$iname
);
if
(
!
empty
(
$wwith
)
||
!
empty
(
$hheight
))
{
$old_filepath
=
''
;
...
...
src/Modules/Login/LoginXhr.php
View file @
de385cab
...
...
@@ -260,6 +260,10 @@ class LoginXhr extends Control
private
function
resizeAvatar
(
$img
)
{
// prevent path traversal
$img
=
preg_replace
(
'/%/'
,
''
,
$img
);
$img
=
preg_replace
(
'/\.+/'
,
'.'
,
$img
);
$folder
=
ROOT_DIR
.
'tmp/'
;
if
(
file_exists
(
$folder
.
$img
))
{
$image
=
new
fImage
(
$folder
.
$img
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment