Skip to content

Commit

Permalink
fix corrupted attributes using context-aware escaping (#296)
Browse files Browse the repository at this point in the history
* fix corrupted attributes using context-aware escaping

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>

*  fix corrupted attributes on preferences page

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>
  • Loading branch information
xh3n1 authored and michield committed May 24, 2018
1 parent 2ba5d93 commit 5968fc7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions public_html/lists/admin/subscribelib2.php
Expand Up @@ -1046,7 +1046,7 @@ function ListAttributes($attributes, $attributedata, $htmlchoice = 0, $userid =
$output[$attr['id']] .= sprintf('</td><td class="attributeinput">
<input type="text" name="%s" class="attributeinput" size="%d" value="%s" id="'.$fieldname.'" />', $fieldname,
$textlinewidth,
$_POST[$fieldname] ? htmlspecialchars(stripslashes($_POST[$fieldname])) : ($data[$attr['id']] ? $data[$attr['id']] : $attr['default_value']));
$_POST[$fieldname] ? str_replace('"', '&#x22;', stripslashes($_POST[$fieldname])) : ($data[$attr['id']] ? $data[$attr['id']] : $attr['default_value']));
if ($attr['required']) {
$output[$attr['id']] .= sprintf('<script language="Javascript" type="text/javascript">addFieldToCheck("%s","%s");</script>',
$fieldname, $attr['name']);
Expand All @@ -1059,7 +1059,7 @@ function ListAttributes($attributes, $attributedata, $htmlchoice = 0, $userid =
$output[$attr['id']] .= sprintf('<tr><td class="attributeinput" colspan="2">
<textarea name="%s" rows="%d" class="attributeinput" cols="%d" wrap="virtual" id="'.$fieldname.'">%s</textarea>',
$fieldname, $textarearows, $textareacols,
$_POST[$fieldname] ? htmlspecialchars(stripslashes($_POST[$fieldname])) : ($data[$attr['id']] ? htmlspecialchars(stripslashes($data[$attr['id']])) : $attr['default_value']));
$_POST[$fieldname] ? str_replace(array('>', '<'), array('&gt;', '&lt;'),stripslashes($_POST[$fieldname])) : ($data[$attr['id']] ? str_replace(array('>', '<'), array('&gt;', '&lt;'),stripslashes($data[$attr['id']])) : $attr['default_value']));
if ($attr['required']) {
$output[$attr['id']] .= sprintf('<script language="Javascript" type="text/javascript">addFieldToCheck("%s","%s");</script>',
$fieldname, $attr['name']);
Expand Down
30 changes: 15 additions & 15 deletions public_html/lists/admin/user.php
Expand Up @@ -270,26 +270,26 @@
// delete the index in delete
$_SESSION['action_result'] = s('Deleting').' '.s('Subscriber').' '.s('ID')." $delete ..\n";
if ($require_login && !isSuperUser()) {
// If the user does not permission to permanently delete, delete
// If the user does not permission to permanently delete, delete
// subscriptoins instead

// Get all lists subscriber is a member of
$lists = Sql_query("
SELECT
listid
FROM
{$tables['listuser']},{$tables['list']}
WHERE
userid = ".$delete."
AND $tables[listuser].listid = $tables[list].id
$subselect
SELECT
listid
FROM
{$tables['listuser']},{$tables['list']}
WHERE
userid = ".$delete."
AND $tables[listuser].listid = $tables[list].id
$subselect
");
while ($lst = Sql_fetch_array($lists)) {
Sql_query("
DELETE FROM
{$tables['listuser']}
WHERE
userid = $delete
DELETE FROM
{$tables['listuser']}
WHERE
userid = $delete
AND listid = $lst[0]
");
}
Expand Down Expand Up @@ -477,7 +477,7 @@ class="confirm btn btn-default"
} elseif ($row['type'] == 'textarea') {
$userdetailsHTML .= sprintf('
<tr><td valign="top" class="dataname">%s</td><td><textarea name="attribute[%d]" rows="10" cols="40" class="wrap virtual">%s</textarea></td>
</tr>', stripslashes($row['name']), $row['id'], htmlspecialchars(stripslashes($row['value'])));
</tr>', stripslashes($row['name']), $row['id'], str_replace(array('>', '<'), array('&gt;', '&lt;'), stripslashes($row['value'])));
} elseif ($row['type'] == 'avatar') {
$userdetailsHTML .= sprintf('<tr><td valign="top" class="dataname">%s</td><td>',
stripslashes($row['name']));
Expand All @@ -493,7 +493,7 @@ class="confirm btn btn-default"
stripslashes($row['name']), UserAttributeValueSelect($id, $row['id']));
} else {
$userdetailsHTML .= sprintf('<tr><td class="dataname">%s</td><td><input class="attributeinput" type="text" name="attribute[%d]" value="%s" size="30" /></td></tr>'."\n",
$row['name'], $row['id'], htmlspecialchars(stripslashes($row['value'])));
$row['name'], $row['id'], str_replace('"', '&#x22;', stripslashes($row['value'])));
}
}
}
Expand Down

0 comments on commit 5968fc7

Please sign in to comment.