Skip to content

Commit

Permalink
commit proposed changes by @Quy
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed May 2, 2018
1 parent 0198123 commit a43a17d
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions components/com_mailto/controller.php
Expand Up @@ -83,31 +83,18 @@ public function send()
'cc:'
);

// An array of the input fields to scan for injected headers
$fields = array(
'emailto',
'sender',
'emailfrom',
'subject',
'link',
'captcha',
);

/*
* Here is the meat and potatoes of the header injection test. We
* iterate over the array of form input and check for header strings.
* If we find one, send an unauthorized header and die.
*/
foreach ($fields as $field)
foreach ($data as $key => $value)
{
if (!empty($_POST[$field]))
foreach ($headers as $header)
{
foreach ($headers as $header)
if (strpos($value, $header) !== false)
{
if (strpos($_POST[$field], $header) !== false)
{
JError::raiseError(403, '');
}
JError::raiseError(403, '');
}
}
}
Expand Down

0 comments on commit a43a17d

Please sign in to comment.