more XSS blockage of uploaded files
This commit is contained in:
parent
b92f00587b
commit
b58baa5e4a
@ -24,7 +24,16 @@ function attach_init(&$a) {
|
|||||||
if(! $c)
|
if(! $c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
$unsafe_types = array('text/html','text/css','application/javascript');
|
||||||
|
|
||||||
|
if(in_array($r['data']['filetype'],$unsafe_types)) {
|
||||||
|
header('Content-type: text/plain');
|
||||||
|
}
|
||||||
|
else {
|
||||||
header('Content-type: ' . $r['data']['filetype']);
|
header('Content-type: ' . $r['data']['filetype']);
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
|
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
|
||||||
if($r['data']['flags'] & ATTACH_FLAG_OS ) {
|
if($r['data']['flags'] & ATTACH_FLAG_OS ) {
|
||||||
$istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb');
|
$istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb');
|
||||||
|
Reference in New Issue
Block a user